It has already been mentioned, use <sstream>
#include <iostream>
#include <string>
#include <sstream>
#include <cwchar>
using namespace std;
int main (int argc, char * const argv[]) {
wstringstream s;
int x;
wcout<< "Enter an integer : ";
wcin >> x;
s << "Value entered is : " << x;
wcout<<s.str();
return 0;
}
#include <iostream>
#include <string>
#include <sstream>
#include <cwchar>
using namespace std;
int main (int argc, char * const argv[]) {
wstringstream s;
int x;
wcout<< "Enter an integer : ";
wcin >> x;
s << "Value entered is : " << x;
wcout<<s.str();
return 0;
}
本文介绍了如何在C++中使用sstream进行输入输出操作,包括如何接收用户输入的整数并将其显示。
9207

被折叠的 条评论
为什么被折叠?



