code.club

標題: C++函數才能返回一個字串 [打印本頁]

作者: enter    時間: 2015-9-15 22:40
標題: C++函數才能返回一個字串
使用 string型別。

例如:

#include <iostream>
using namespace std;

string test(string a){
       
        return a;
}

int main(){
       
        cout<<test("hello world");
       
        return 0;
}




歡迎光臨 code.club (http://code.club/) Powered by Discuz! X3.2