/**************************/ /*Allan Clark Alterm.cpp*/ /*Nov 20/02 */ /*This program will generate */ /*up to 30 #'s and then */ /*store them in an array */ /*as students marks */ /**************************/ #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, pointer[31]; void input(string25& fname, string25& lname) { cout << setiosflags(ios:: fixed); cout << setprecision(0); //Fowler Statement// cout << endl << endl; cout << "\t Term Marks Version 0.0" << endl << endl; cout << "\t ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*" << endl; cout << "\t ~ This program will generate a chart *" << endl; cout << "\t ~ number for 5 students *" << 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 Term ||" << endl; cout << "\t\t|| Marks Generater ||" << endl; cout << "\t\t|| Please enter the ||" << endl; cout << "\t\t|| marks of your ||" << endl; cout << "\t\t|| students ||" << 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 << " How many students are in your class?....: "; cin >> limit; cout << endl; if(limit > 30) { cout << "Too many students"; cout << endl; getch(); } if(limit < 1) { cout << "You don't have any students?"; cout << endl; } } while(limit > 30 | limit < 1);*/ } void output(string25 fname, string25 lname, string25 name, int& limit, int& fail, int& pass, int& x, int& y, int& temp, int& count, int& best, int& temp2) { input(fname, lname); int out; getch(); clrscr(); time_t t=time(NULL); cout<<" " << ctime(&t)<< endl << endl; //Displays the time// cout << "\t\t\t CLASS STATS" << endl; cout << "\t\t\t ~~~~~~~~~~~" << endl; cout << endl << endl; name = lname + ", " + fname; cout << "\tName of Teacher: " << name; cout << "\t Class Size: 5" << endl; cout << endl << endl; cout << " Student # Term1 % Term2 % Term3 % Term4 % Term5 % Term6 %" << endl; cout << " ~~~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~"; /* randomize(); for(out = 1; out <= limit; out++) { limit1 = random(101); array[out] = limit1; pointer[out] = out; } out = 1; pass = 0; fail = 0; while(out <= limit) { out++; if(array[out] < 50) {fail++;} if(array[out] >= 50) {pass++;} } for(x = 1; x <= limit; x++) { for(y = x+1; y <= limit; y++) { if(array[x] >array[y]) { temp = array[x]; array[x] = array[y]; array[y] = temp; temp2 = pointer[x]; pointer[x] = pointer[y]; pointer[y] = temp2; } } } */ } int main(void) { char yes; do { string25 fname, lname, name; // Declaration of Local Variables // int out, guess, limit, limit1, array, pass, fail, x, y, temp, count, best, temp2; clrscr(); output(fname, name, lname, limit, pass, fail, x, y, temp, count, best, temp2); 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'); }