[关闭]
@Drluo 2020-04-23T12:57:49.000000Z 字数 658 阅读 543

C++学习

C++



type

int
float
double
char
bool

变量定义

format:
type variable_name = value;
(类型 变量名 = 值 ;)

example:
int ppdog = 1;
float ppdog = 0.1;
double ppdog = 0.01;
char ppdog = a;
bool ppdog = true;

测验一

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. cout << "Hello World";
  6. cout << "你好世界";
  7. return 0;
  8. }
  9. ----------
  10. 输出结果:
  11. Hello World你好世界

测验一(改动)

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. cout << "Hello World" << endl;
  6. cout << "你好世界";
  7. return 0;
  8. }
  9. ----------
  10. 输出结果:
  11. Hello World
  12. 你好世界

测验二

  1. #include <iostream>
  2. using namepace std;
  3. int main()
  4. {
  5. int a = 1;
  6. int b = 9;
  7. int c,d;
  8. c = a - b;
  9. d = a + b;
  10. cout << c;
  11. cout << d;
  12. return 0;
  13. }
  14. ----------
  15. 输出结果:
  16. -810

测验三

  1. #include <iostream>
  2. using namepace std;
  3. int main()
  4. {
  5. int a = 1;
  6. cout << "a";
  7. cout << a;
  8. return 0;
  9. }
  10. ----------
  11. 输出结果:
  12. a1
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注