Hi all,
Im having a little trouble. I have to write a program that will input a string of positive integers terminated by a negative integer and then sort it.I have done the sorting part and it works fine.But the part that the string continues to get integers unless a negative integer entered is causing problem. Here is my code which i wrote to get the string..Please tell me what is the problem with my code?
void getLine(string line)
{
getline(cin,line);
for (int m = 0 ; m < line.length() ; m++)
{
if (str[k] == '-')
{
line = line.substr(0,k-1);
return;
}
}
getString(line);
}