how can i group the names into three group using 2D arrays??

pls help me about my problem.. i dont know how to group the names into three group.. pls help me. according to my teacher we will use the 2D arays but i dont know how to use it... heres my code..


#include <iostream>
#include <stdlib.h>

using namespace std;
int a, stud;
int main ()
{
const int MAX = 35;
char *names[ MAX ] = {
"\n\ capili",
"\n\ roces",
"\n\ flores",
"\n\ crpio" ,
"\n\ amera",
"\n\ sumantin",
"\n\ Lim",
"\n\ daviza",
"\n\ angulo",
"\n\ michael",
"\n\ tulio",
"\n\ abad",
"\n\ tejedillio",
"\n\ ng",
"\n\ balbarona",
"\n\ caballes",
"\n\ ipong",
"\n\ pepillio",
"\n\ clemente",
"\n\ junsay",
"\n\ deypalubos",
"\n\ Lines",
"\n\ quino",
"\n\ yaun",
"\n\ moril",
"\n\ arastam",
"\n\ laurente",
"\n\ montejes",
"\n\ racho",
"\n\ david",
"\n\ umanan",
"\n\ fampulme",
"\n\ suratos",
"\n\ oliveros",
\n\ pain", };
int random;


cout << "The names in order: " << endl;

for( int i = 0; i < MAX; i++ )
{
cout << names[ i ] << " ";
}

for( int i = 0; i < MAX; i++ )
{
random = rand() % 35 ;
char *temp = names[ i ];
names[ i ] = names[ random ];
names[ random ] = temp;
}

cout << "\n\nThose names randomized.." << endl;
cout<<"Input the number of the student: ";
cin>>a;
for( int i = 0; i < MAX; i++ )
{
cout << names[ i ] << " ";
}



system("PAUSE");
return 0;
}
Topic archived. No new replies allowed.