/*****************************************/ /*Allan Clark*****************Alvoice.cpp*/ /*Nov 25/02*******************************/ /*This program will generate**************/ /*an invoice for up to 10 items 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]; double pointer[31]; double array2[31]; double pointer2[31]; double limit1; double price[101], quantity[11]; int ctr; void input(char fname[15], char lname[15], double& limit) { cout << setiosflags(ios:: fixed); cout << setprecision(0); //Fowler Statement// cout << endl << endl; cout << "\t Invoice Extension Version 0.0" << endl << endl; cout << "\t ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*" << endl; cout << "\t ~This program will generate an invoice*" << endl; cout << "\t ~ of up to 10 items and then store *" << endl; cout << "\t ~ them in an array *" << 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 > 10) {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); ctr = 0; for(ctr = 1; ctr <= limit; ctr++) { clrscr(); cout << endl << endl << endl; cout << "\t[]***************************************[]" << endl; cout << "\t|| Prices and Quantities Page ||" << endl; cout << "\t|| ||" << endl; cout << "\t|| !@$$@!!@$$@!!@$$@!!@$$@! ||" << endl; cout << "\t|| ||" << endl; cout << "\t|| Please enter the price ||" << endl; cout << "\t|| and quantity of each item ||" << endl; cout << "\t|| ||" << endl; cout << "\t[]***************************************[]" << endl; gotoxy(9,20); cout << endl << "\t Please enter the quantity of item " << ctr << " : "; cin >> quantity[ctr]; gotoxy(9,21); cout << endl << "\t Please enter the price of item " << ctr << " : "; cin >> price[ctr]; quantity[ctr]; getch(); } } void output(char fname[15], char lname[15], char name[30], double& limit, double& x, double& y, double& temp, int& ctr, double& temp2, int& cordx, int& cordy, double& ext, double& gross) { input(fname, lname, limit); 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 Number of Items Purchased: " << limit << endl; cout << endl << endl; cout << " Item #\tQuantity\t Price\t Extension" << endl; cout << " ~~~~~~\t~~~~~~~~\t ~~~~~\t ~~~~~~~~~" << endl << endl; ctr = 0; cordx = 22; cordy = 14; gross = 0; cout << setiosflags(ios:: right); while(ctr != limit) { cout << setprecision(0); ctr++; ext = price[ctr] * quantity[ctr]; cout << " " << ctr; gotoxy(cordx,cordy); cordy++; cout << quantity[ctr] << " $" << setprecision(2) << price[ctr] << " $" << ext << endl; getch(); gross = gross + ext; } cout << endl << "\t\t\t\t\t\t _________"; cout << endl << "\t\t\t\t\t\t ~~~~~~~~~"; cout << endl << "\t\t\t\t Total Gross: " << gross << endl << endl;} int main(void) {char yes; do { char fname[15], lname[15], name[30], blank; // Declaration of Local Variables // double out, guess, limit, limit1, array, x, y; double temp; int ctr, cordx, cordy; double temp2, ext, gross; clrscr(); output(fname, name, lname, limit, x, y, temp, ctr, temp2, cordx, cordy, ext, gross); cout << endl; cout << "\t\t\t Invoice Complete" << endl; cout << " Do you wish to make another one? (y/n) "; cin >> yes; if(yes != 'y') {return 0;} }while(yes = 'y');}