变量名称

变量(盛饭的碗,一个有名字的碗,一个空的碗,可以盛上饭,可以盛不同的饭,就是赋值不同的数值)

  1. int a;
  2. a = 5;
  3. int b = 2;
  4. int c, d, e, f;
  1. // n个数
  2. int n;
  3. // 一个数
  4. int n;
  5. int x;
  6. // 两个数
  7. int a, b;
  8. int x, y;
  9. // 求和
  10. int sum;
  11. // 计数
  12. int cnt;
  13. // 写循环, i, j, k
  14. for (int i = 0; i < n; i++)
  15. for (int j = 0; j < m; j++)
  16. for (int k = 0; k < p; k++)
  17. // 如果有更多层的循环,i1, i2, i3, i4
  18. // 开数组
  19. const int N = 110;
  20. int a[N];
  21. const int N = 1e5 + 10;
  22. int a[N];
  23. // n行,m列的矩阵
  24. int n, m;
  25. // 坐标
  26. int x, y;
  27. // 和生活中的一些事物,有关联
  28. // 钱,时间,距离
  29. int money, int tim, int dis
  30. int d;
  31. // 临时变量,存一些中间信息
  32. int temp;
  33. int t;
  34. // 有n组数据
  35. int T;
  36. while (T--){
  37. }
  38. // 奥义
  39. // 英文单词简写(缩写)

标准数据类型

  1. // 以下几个单词,要记笔记
  2. int, 整型,用来存整数
  3. double, 双精度浮点型,用来存小数/实数
  4. char, 字符类型,用来存字符
  5. bool, 布尔类型,用来存true/false
  6. long long, 长整型,用来存爆int的数,1e18这个量级的
  7. string, string类,用来存字符串的
  8. // 其他不常用的:
  9. short, 短整型
  10. float, 单精度浮点数