/**************************/ /*Allan Clark Allists.cpp*/ /*Nov 20/02 */ /*This program will generate */ /*up to 30 #'s and then */ /*store them in an array */ /**************************/ #include //The library call for input/output #include //The library call for input/output manipulation #include //The library call for clrscr() #include //The library call used to manipulate string variables. #include //The library call to use math equations (sqrt) #include //The library call for random number #include //The library call to acquire the system's date int array[31], limit1; void input(char fname[15], char lname[15], int& limit) { cout << setiosflags(ios:: fixed); cout << setprecision(0); //Fowler Statement// cout << endl << endl; cout << "\t Random Listing Version 2.1" << endl << endl; cout << "\t ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*" << endl; cout << "\t ~ This program will output random *" << endl; cout << "\t ~ numbers within a specified range *" << endl; cout << "\t ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*" << endl; cout << endl; cout << " // Allan Clark - Programmer //" << endl << endl; cout << " Press Any Key to Continue"; getch(); // gets character // clrscr(); //Clears the fowler screen and goes to the input screen// cout << "\t\t[]-----------------------------[]" << endl; cout << "\t\t|| ||" << endl; cout << "\t\t|| Welcome to the Random ||" << endl; cout << "\t\t|| List Generater Please ||" << endl; cout << "\t\t|| enter a limit ||" << endl; cout << "\t\t|| Between 1 and 30 ||" << endl; cout << "\t\t|| ||" << endl; cout << "\t\t|| This Program will ||" << endl; cout << "\t\t|| generate numbers between ||" << endl; cout << "\t\t|| 1 and 100 ||" << endl; cout << "\t\t|| ||" << endl; cout << "\t\t[]-----------------------------[]" << endl; cout << endl << " What is your first name?................: "; cin >> fname; cout << endl << endl; cout << " What is your last name?.................: "; cin >> lname; cout << endl << endl; do { cout << " What is your Desired Limit?...........: "; cin >> limit; cout << endl; if(limit > 30) { cout << "Your limit is too high"; cout << endl; getch(); } if(limit < 1) { cout << "Your limit is too low"; cout << endl; } } while(limit > 30 | limit < 1); } void output(char fname[15], char lname[15], int& limit) { input(fname, lname, limit); int out; getch(); clrscr(); time_t t=time(NULL); cout<<" " << ctime(&t)<< endl << endl; //Displays the time// cout << "\t\t\t RANDOM LISTS" << endl; cout << "\t\t\t ~~~~~~~~~~~~" << endl; cout << endl << endl; cout << "\tName of User: " << fname << ", " << lname; cout << "\t Array Limit: " << limit << endl; cout << endl << endl; randomize(); for(out = 1; out <= limit; out = out + 1) { limit1 = random(100)+1; array[out] = limit1; } out = 1; while(out <= limit) { out++; cout << setw(10); if(out == 8 | out == 14 | out == 20 | out == 26 | out == 32) { cout << endl; cout << setw(10); } cout << array[out]; getch(); } cout << endl; } int main(void) { char yes; do { char fname[15], lname[15]; // Declaration of Local Variables // int out, guess, limit, limit1, array; clrscr(); output(fname, lname, limit); cout << endl; cout << "\t\tThe Array File is Complete" << endl; cout << " Do you wish to make another one? (y/n) "; cin >> yes; if(yes != 'y') {return 0;} } while(yes = 'y'); }