
demo.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | // 引入標準程式庫中相關的輸入、輸出程式 #include <iostream> // 引入標準程式庫中相關的字串程式 #include <string> // std 為標準程式庫的命名空間 using namespace std; int main( void ) { // 下面建立名稱為 m , string 型態的物件 // 小括弧為 string 的建構子 // 雙引號為字串字面常數 string m( "There is no spoon." ); // cout 用來輸出的物件 // endl 為新行符號 '\n' cout << endl; cout << m << endl; cout << endl << endl; return 0; } /* 檔名: demo.cpp 作者: Kaiching Chang 時間: 2014-5 */ |
demo2.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <iostream> #include <string> using namespace std; int main( void ) { string m( "There is no spoon." ); cout << endl; cout << m << endl; cout << endl << endl; return 0; } /* 檔名: demo2.cpp 作者: Kaiching Chang 時間: 2014-5 */ |
demo3.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> #include <string> int main( void ) { string m( "There is no spoon." ); cout << endl; cout << m << endl; cout << endl << endl; return 0; } /* 檔名: demo3.cpp 作者: Kaiching Chang 時間: 2014-5 */ |
demo4.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> #include <string> int main( void ) { std::string m( "There is no spoon." ); std::cout << std::endl; std::cout << m << std::endl; std::cout << std::endl << std::endl; return 0; } /* 檔名: demo4.cpp 作者: Kaiching Chang 時間: 2014-5 */ |
demo5.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <iostream> #include <string> int main( void ) { std::string m( "There is no spoon." ); std::cout << std::endl << m << std::endl << std::endl << std::endl; return 0; } /* 檔名: demo5.cpp 作者: Kaiching Chang 時間: 2014-5 */ |
the end

沒有留言:
張貼留言