0
에서 istringstream 정의를 이동할 수 없습니다 내가 다음 코드 조각이 :C는 + + - 루프
다음과 같은 오류 발생#include <sstream>
#include <iostream>
using namespace std;
int main()
{
string inp, s;
istringstream iss;
do
{
getline (cin, inp);
iss(inp);
int a = 0, b = 0; float c = 0;
iss >> s >> a >> b >> c;
cout << s << " " << a << " " << b << " " << c << endl;
}
while (s != "exit");
}
:
error: no match for call to ‘(std::istringstream) (std::string&)’
내가 문제가 피할 수 있다는 것을 알고를 그러나 루프 내에서 istringstream iss(inp);
을 사용하면이 정의를 루프 밖으로 옮길 수 있습니까?
는
당신은'istringstream'의'str' 함수를 찾고 있다고 생각합니다. 또한 여기를 참고하십시오 : [C++에서 stringstream 변수를 지우는 방법은 무엇입니까?] (http://stackoverflow.com/questions/20731/in-c-how-do-you-clear-a-stringstream-variable) – jogojapan
You http://en.cppreference.com/w/cpp/io/basic_istringstream/str을 의미합니까? –
'iss.str (s);'를 사용하십시오. – 0x499602D2