More information is needed on what exactly you are to accomplish. If you already have some code written but it doesn't do what you want, then you can post it and we can help you correct it.
int answer = 0;
do
{
std::cout << "\nSelect what you want to do:\n";
std::cout << "Read elements of the array.......1\n";
std::cout << "Display elements of the array....2\n";
std::cout << "Exit the program.................0\n";
std::cout << "\nYour choice: ";
std::cin >> answer;
switch ( answer )
{
case 1:
// enter elements of the array
break;
case 2:
// display elements of the array
break;
default:
if ( answer != 0 )
{
std::cout << "\nError: invalid input. Try anew." << std::endl;
}
break;
}
} while ( answer != 0 );
in the function we have to open the file and display it in a 2D array.
and in the switch statement, we have to call the function, here's some codes
hope you can help me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
switch(choice){
case 1: ReadRegistrations (RegP, regsize);break;
case 2: cout << "Enter event ID: ";
cin >> eid;
ListAthletesByEvent (RegP, regsize, eid);
break;
case 3: cout << "Enter country: ";
cin >> country;
ListAthletesByCountry (RegP, regsize, country);
break;
case 4: ReadResults (arr_results [][COLUMN_SIZE], regsize); //this is where we are stuck in...the underlined bracket (]) is the syntax error
break;
case 5: break;
case 6: break;
case 7: break;
default: cout << "incorrect choice, try again\n"; break;