c++primer chapter three

3.1命名空间的using声明

using声明具有如下的形式:using namespace :: name;

1 #include <iostream>
2 
3 
4 using std :: cout; using std :: endl;
5 
6 int main(){
7     int i = 9;
8     cout << i << endl;
9 }
View Code

初始化string对象的方式

string s1;

string s2(s1);

string s2 = s1;

string s3("value")

string s3 = "value"

string s4(n,'c')

string对象上的操作

 

posted @ 2019-06-04 10:52  菜鸟0002  阅读(95)  评论(0编辑  收藏  举报