数据的输出
#include <iostream>
using namespace std;
int main()
{
int a =2;
double b = 3.32;
char c = 'A';
cout<<a<<' '<<b<<endl;
cout<<c<<' '<<"abcd"<<endl;
system("pause");
return 0;
}
数据的输入
#include <iostream>
using namespace std;
int main()
{
int a ;
float b;
cout<<"input a,b:";
cin>>a>>b;
cout<<"a+b="<<a+b<<endl;
system("pause");
return 0;
}
上课解答与专用理解
//#include <stdio.h>
#include <iostream>
//stream:流
//输入输出流
using namespace std;
//using 使用
//name space 命名 空间
int main()
{
//cout :输出
//<< :(C :左移运算符) >>:右移
// << :流操作符 :流输出 :将数据流出到输出
// "hello world" 通过流操作符流出到cout
// \n :换行符等转移符号在流操作中也是可以的
//cout << "hello world" << endl1;
cout << "hello world";
// >> :流入
int x;
int y;
cin >> x >> y;
cout << x << endl << y << endl;
system("pause");//暂停程序窗口
return 0;//表示程序运行正常
//
}
/*
\r :回车 (return)
\n :换行 ( new line)
*/