<pre name="code" class="cpp">#include<iostream>
using std::cout;//identifier(名字,标示符) scope(作用域)
using std::cin;// using directive(using指令)
using std::endl;
//using namespace std;//名字空间(namespace) name clashing(名字冲突)
int main()
{
int x = 10;
float f = 0.23;
char s[]="Ligang";
std::cout<<"Hello,"
<<s
<<x
<<f
<<std::endl;//::作用域运算
return 0;
}
int main()
{
char s[100]="";//initialization(初始化)
int x[10] = {0};
cout<<"input a string followed by an integer:";
cin>>s>>x[0];
cout<<s<<","<<x[0]<<endl;
return 0;
}
C++ first class
最新推荐文章于 2024-08-04 11:15:43 发布