Hello All,
Its me again with my quirky questions.
I am writing a program for homework and the idea is to sort the top 3 runners by their finishing time.
Also a requirement of the homework is to gather the names of the runners along side their times. The user should enter a name that would not overflow the array. I have:
const int iLength = 21; //20 Chars + 1 null terminator.
and
//3 char. variables to hold 3 user input.
char cRunner1[iLength], cRunner2[iLength], cRunner3[iLength];
and
//Accept the name of the runner.
cout << "Name of Runner number 1: ";
cin.getline(cRunner1, iLength);
I would like to put the last two lines in a While Loop to prevent the user from going over the 20 character limit, but I do not know how to figure out the length of the string entered.
Any help and clarification will be greatly appreciated.
Thanks