C++的一些基础用法2

回顾一下上次介绍的内容
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;
}
1 个赞

@刘子睿

代码框架来了

OK,赞赞走起

1 个赞

@linan05062 是float吧不是flout

1 个赞

对对对!
谢谢指正!

@linan05062 什么时候出难的?

这毕竟是基础用法讲析

以后一步步变难的!!!

其实是因为难的我自己都不会

没发现吗,long longlong long int 明明是同一个东西。不需要将long long int 归为超长整型。甚至表格里面这俩范围都一样,还给归为两类

ok,ok,我知道了,但是我好像修改不了话题了…