I have tried something like the below, but I think that it doesn't work since each line that has a number, stores whatever follows that number.
for (i = 0; i < num; i++)
{
if(list[i] != "3")
{
cout << i << ":" << list[i]<<endl;
}
}
I don't quite get why that would work even if all the lines have numbers, because getline() retrieves the full line, including the text after the number in your case. Comparing that entire line with a single number isn't going to work, whether the line has a number in front of it or not.
To print out all the lines, I'd suggest a simple loop:
for (int i=0; i<num; i++)
cout << i << ":" << list[i] << endl;
Now all you need to do is remove line numbers on the lines that do happen to have numbers.
For removing the number, I'd suggest using string::find_first_not_of with a single space as an argument. Now check that the character found is not a number with
isalpha, and then you can proceed either by removing the number if it is one, or simply leaving the string as-is.
Or did I totally misunderstand what you're trying to do?