前言
我們可以使用 std::to_string,把變數轉為 string 的型態。
範例程式碼
#include <iostream>
using namespace std;
int main(){
string s = to_string(123);
s += "test";
cout << s << endl;
return 0;
}
search words
- int to string C++
我們可以使用 std::to_string,把變數轉為 string 的型態。
#include <iostream>
using namespace std;
int main(){
string s = to_string(123);
s += "test";
cout << s << endl;
return 0;
}