can someone help me, this little demo program (to convert string to stream) seems to be stuck in the while loop
can someone give me a suggestion
objective to loop though a string of varying lengths and separate out the words by the commas
Code:
#include <iostream.h>
#include <stdlib.h>
#include <string>
#include "sstream.h"
int main()
{
string s="John Jones, Day, Night,";
string temp;
istringstream iss(s);
while(true)
{
getline(iss, temp,',');
if(temp.size()==0) break;
cout << temp <<" ";
}
system("PAUSE");
return 0;
}