#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
printf("Hello World!/n");
cout << " hello! /n"
<< 8 << " World " <<endl;
cin>>num;
cout << "octal value: /n"
<<oct<< num <<endl;
cout << "dec value: /n"
<<dec<< num <<endl;
cout << "hex value: /n"
<<hex<< num <<endl;
cout << "non printing char(escape): /n"
<<char(27)<<endl;
return 0;
}
#include <iostream.h>
int main(int argc, char* argv[])
{
string s1,s2;
string s3 = "Hello!";
string s4("World! ");
s2 = "Today!";
s1 = s3 + " " + s4;
s1 += "8";//Appending to a string
cout << s1 + s2 + "!"<<endl;
printf("Hello World!/n");
cout << " hello! /n"
<< 8 << " World " <<endl;
cout << "Hello! /n"
<<" /b Hello World "
<<"/b yy /b /n";
return 0;
}
#include <iostream>
int main(int argc, char* argv[])
{
printf("Hello World!/n");
std:: cout << "Input num "
<< 8 << " /b please " <<endl;
return 0;
}
名字空间与包含头文件的方法也是有关系的。如上红字,执行后,看到的效果是一样的。