/**************************/ /*Allan Clark Alprice.cpp*/ /*Nov 25/02 */ /*This program will generate */ /*up to 30 prices 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 double array[31]; int pointer[31]; double array2[31]; int pointer2[31]; double limit1; void input(char fname[15], char lname[15], int& limit, int& scndlimit) { cout << setiosflags(ios:: fixed); cout << setprecision(0); //Fowler Statement// cout << endl << endl; cout << "\t Price Comparison Version 0.0" << endl << endl; cout << "\t ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*" << endl; cout << "\t ~ This program will generate a random *" << endl; cout << "\t ~ prices for up to 30 Objects *" << 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 Price ||" << endl; cout << "\t\t|| Comparison Generater ||" << endl; cout << "\t\t|| Please enter the ||" << endl; cout << "\t\t|| amount of items you ||" << endl; cout << "\t\t|| want ||" << 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; limit = 0; do {cout << " How many items do you want...........: "; cin >> limit; cout << endl; if(limit > 30) {cout << "Too many items"; cout << endl; getch();} if(limit < 1) {cout << "You don't want any items?"; getch(); cout << endl;}}while(limit > 30 | limit < 1); scndlimit = limit;} void output(char fname[15], char lname[15], char name[30], int& limit, int& fail, int& pass, int& x, int& y, double& temp, int& count, int& best, double& temp2, double& temp3, double& temp4, int& scndlimit) { input(fname, lname, limit, scndlimit); int out; getch(); clrscr(); time_t t=time(NULL); cout<<" " << ctime(&t)<< endl << endl; //Displays the time// cout << "\t\t\t PRICE COMPARISON" << endl; cout << "\t\t\t ~~~~~~~~~~~~~~~~" << endl; cout << endl << endl; strcpy(name, lname); strcat(name, ", "); strcat(name, fname); cout << "\tName of Person: " << name; cout << "\t Limit number: " << limit << endl; cout << endl << endl; randomize(); for(out = 1; out <= limit; out++) { limit1 = random(10000)+1; limit1 = limit1/100; array[out] = limit1; pointer[out] = out; } 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;}}} /* for(x = 1; x <= scndlimit; x++) {for(y = x+1; y <= scndlimit; y++) {if(array[x] > yes; if(yes != 'y') {return 0;} }while(yes = 'y');}