I am writing this program that reads in lines from a txt file into an array. Some lines start with a number and some don't. Problem is that I need help on how to display the lines that don't start with a number.
Examples of txt file:
Students
3 Girls
4 Boys
Code I have so far:
getline(inFile,row); //read each line in file
while(!inFile.eof())
{
list[count] = row; //store each line in array
count ++;
getline(inFile,row);
}
I just don't know how to get each line that doesn't start with a number from the array and display it.
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;
}
}