I need help with using the rand() function and an array to create 19 random numbers when the user types 'P' instead when I type 'P' I get 19 rows of 19 numbers
int main ()
{
char command;
double setNum [19];
int create;
create = 0;
cout << "***************************************************" << endl;
cout << "* *" << endl;
cout << "* MENU *" << endl;
cout << "* N/n : Create A New Set Of Numbers *" << endl;
cout << "* P/p : Print Numbers To Screen *" << endl;
cout << "* S/s : Calculate & Print Sum Of Numbers *" << endl;
cout << "* A/a : Calculate & Print Average Of Numbers *" << endl;
cout << "* M : Determine Maximum Value & Location *" << endl;
cout << "* m : Determine Minimum Value & Location *" << endl;
cout << "* Q/q : Quit *" << endl;
cout << "***************************************************" << endl;
cout << "Command => ";
cin >> command;
srand(time(NULL));
while(create < 19)
{
setNum[create] = rand();
create++;
switch (command)
{
case 'N':
case 'n':
break;
case 'P':
case 'p':cout <<"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" << endl;
cout <<create;
break;
case 'S':
case 's':
break;
case 'A':
case 'a':
break;
case 'M':
break;
case 'm':
break;
case 'Q':
case 'q':
break;//system ("cls");
}
}
cin.ignore();//flush input buffer
getchar ();
}
}