回顾一下上次介绍的内容
https://discourse.xinyoudui.com/t/topic/38864
这次,讲一下其他内容
变量与输入
首先,是变量的定义
- 定义变量的表格
样式 | 范围 | 形式 | 字节长度 |
---|---|---|---|
short | -32768~32767 | 短整型 | 2 |
int | -2147483648~2147483647 | 整型 | 4 |
long long | -9223372036854775808~9223372036854775807 | 长整型 | 8 |
long long int | -9223372036854775808~9223372036854775807 | 超长整型 | 8 |
char | -128~127 | 字符型(单字符) | 1 |
string | \ | 字符串 | 8(64位运行环境)\4(32位运行环境) |
bool | 0~1 | 布尔 | 1 |
float | -3.4 * 10^38~3.4 * 10^38 | 单精度浮点型 | 4 |
double | -1.79 * 10^308~1.79 * 10 | 双精度浮点型 | 8 |
**欢迎补充!**
- 定义
#include<iostream>
using namespace std;
int main(){
int a;//定义整形变量a
short b;
......
}
↓ 定义变量方法
样式 + 空格 + 变量名
- 输入
#include<iostream>
using namespace std;
int main(){
int a;
cin>>a;//输入变量a
}
↓输入格式
cin + >> + 变量名 + ;
另外:
https://discourse.xinyoudui.com/t/topic/38864/9
这里是基础框架
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
struct Node{
int a;
int b;
} node [ N ] ;
cmp ( Node a , Node b) {
return node.a < node.b ;
}
int main(){
return 0;
}