本帖最後由 林以諾 於 2013-12-15 14:16 編輯
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- string str1="hello! pig";
- cout<<str1<<endl;
-
- char str2[7]={"Hello!"};
- cout<<str2<<endl;
- char str3[6]={'H','e','l','l','o','!'};
- for(int i=0; i<=5; i++)
- cout<<str3[i];
- cout<<endl;
-
- string str4[4]={"Hello! ","My ","name ","is ","pig",};
- for(int i=0; i<=4; i++)
- cout<<str4[i];
- cout<<endl;
-
- system("pause");
- return 0;
- }
複製代碼 |