Below is my code.
My assignment is to write a code to ask the user to enter the amount of people in the class between 1 and 25. Then enter that many names and it will list the first and last name alphabetically. ex. jon matt kate = jon matt
I do not know much about writing code but the loop is giving me problems.
and also i have an error code: error '>>' no operator matches operand when i have cin >> nameArray.
#include <iostream>
#include <string>
using namespace std;
string nameArray[25];
int main()
{
int numStudents;
for(int x = 0; x < numStudents; x++)
{
cout << " Please enter name " << x+1 << endl;
cin >> nameArray;
for(int x = 0; x < numStudents; x++)
{
cout << " Name " << x+1 << x++ << endl;
}
system("pause");
return 0;
}