64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include<sstream>
#include <string>
using namespace std;
int main()
{
char c;
string a{ "abc" };
istringstream in(a);
while (1)
{
if (in.eof()) break;
in >> c;
cout << c << " ";
}
system("pause");
return 0;
}
#include <iostream>
#include<sstream>
#include <string>
using namespace std;
int main()
{
char c;
string a{ "abc" };
istringstream in(a);
while (1)
{
if (in.peek() == ' ') in.ignore(1024, ' ');
if (in.eof()) break;
in >> c;
cout << c << " ";
}
system("pause");
return 0;
}
#include <iostream>
#include<sstream>
#include <string>
using namespace std;
int main()
{
char c;
string a{ "abc" };
istringstream in(a);
while (1)
{
if (in.peek() == ' ') in.ignore(1024, ' ');
if (in.fail()) break;
in >> c;
cout << c << " ";
}
system("pause");
return 0;
}