|
C++输入输出: - <font color="#001000"><font style="background-color:rgb(255, 255, 255)"><font face="Tahoma">
- #include <stdlib.h>
- #include <iostream>
- #include <string>
- using namespace std;
- /**
- * C++输入输出demo
- */
- int main() {
- int x, y;
- cout << "C++";
- cout << "666666" << endl;
- cout << "006030 -> " << 3 + 0 + 6 << endl;
- cin >> x >> y;
- cin >> x >> y;
- cin >> y;
- cout << "x + y -> " << x + y << endl;
- return 0;
- }</font></font></font><font color="#001000"><font style="background-color:rgb(255, 255, 255)">
- </font></font>
复制代码C++新特性:
- #include <iostream>
- using namespace std;
- int main() {
- // 1、新的数据类型
- bool flag = true;
- if(flag){
- cout << flag << endl;
- cout << boolalpha << flag << endl;
- }
- // 2、直接初始化
- int i(32);
- cout << i << endl;
- const j(10);
- cout << j << endl;
- // 3、随用随定义跟Java类似
- return 0;
- }
复制代码
C++数据类型的引用:
- #include <iostream>
- using namespace std;
- int main() {
- // 1、新的数据类型
- bool flag = true;
- if(flag){
- cout << flag << endl;
- cout << boolalpha << flag << endl;
- }
- // 2、直接初始化
- int i(32);
- cout << i << endl;
- const j(10);
- cout << j << endl;
- // 3、随用随定义跟Java类似
- return 0;
- }
复制代码
|