It'll be easier if u change int num to char and break on '0'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
int num; //probably should be a char
string input;
while( true ){
cin >> num; //use 'cin' to store chars since ur using strings
if( num == 0 ) //now need to compare for the char '0'
return 0; //why return ? do u mean break; ?
//the 'int num' that goes in here is a value identifying a character on the ascii
//table so it wont print out what u expect. again, just use char num instead...
input.push_back(num);
}//didin't see the end of the while loop
cout << input <<endl; //this here ? to see the final result
Sleep(3000); //to keep the console open