Hi i just started learning C++ & we were given homework to write code that will show names numbered to six and display the longest name entered. i have managed to show the names going in numeric order just can't display the longest one. Thanks for any future help... (Also don't know how to inclose code properly so sorry)
//Creating programe to store names & display names with max of 30 characters
#include <iostream.h>
main()
{
char name[6][20];
int num = 1, a = 1, row;
//for loop to cycle 6 names & proceed to next step
cout << "Please Input 6 Names\n";
cout << "\n";
for (row = 0; row < 6; row++){
cout << "Enter Name:" << num++ << " of 6\n";
cin >> name[row];
}
cout << "\n";
//Cout is used on each of them to show the names in numeric order
{
cout << "The List Of Names Are:\n";
for (row = 0; row < 6; row++){
cout << a++ << ". " << name[row] << "\n";
}
}
return 0;
}