//标准输入输出流使用示例
//:
#include <iostream>//C++标准输入输出流
#include <cstdlib>//C语言的标准输入输出流
#include <string>//C++的string类
using namespace std;
u
int main(void){
cout<<"hello,"
<<8<<",Today"<<std::endl;
//打印十进制、八进制、十六进制
cout<<"用十进制、八进制、十六进制显示数据"<<std::endl;
cout<<"a number in decimal "<<dec<<15<<std::endl;
cout<<"in octal: "<<oct<<15<<std::endl;//八进制,oct
cout<<"in hex: "<<hex<<15<<std::endl;//十六进制,hex
cout<<"a floating-point number "<<3.1415926<<std::endl;//编译器会自动确定浮点数的格式
cout<<"non-printing char(espace): "<<char(27)<<std::endl;//任何字符都会转化成char类型(单字符数据类型)
// C++字符数组的拼接
cout<<"C++字符串拼接显示"<<std::endl;
cout<<"This is far too long to put on a"
"single line but it can be broken up with"
"no ill effects \n as long as there is no"
"punctuatation separating adjacent character"
"arrays.\n"<<std::endl;
//C++标准输入流
cout<<"使用标准输入流向控制台输入数据"<<std::endl;
int number;
cin>>number;
cout<<"value int octal=0"<<oct<<number<<std::endl;//用八进制把输入的数据打印出来
cout<<"value in hex=0x"<<hex<<number<<std::endl;//用十六进制把输入的数据打印出来
//C++使用C语言的库函数
system("java -version");//向DOS批处理程序中输入字符串调用其他程序
//使用C++的string类,用来处理并隐藏字符数组的低级操作
cout<<"使用C++的string类\n";
string s1,s2;
string s3="Hello,World";
string s4="I am";
s2="Today";
s1=s3+" "+s4;
s1+=" 8 ";
cout<<s1+s2+"!"<<std::endl;
return 0;
}//:~
cin>> 、cout<<:其实就<<、>>是操作符重载,就相当于把一个值赋给一个对象。