//Allan Clark Alshop.cpp// //Nov 15/02// //This program will calculate the cost of won shopping spree #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 to acquire the system's date// int main(void) { // Declaration of Local Variables // char fname[15], lname[15]; double items, purchaseex, count = 0, items1; //Fowler Statement// cout << endl << endl; cout << "\t ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*" << endl; cout << "\t ~This program will calculate the cost*" << endl; cout << "\t ~ of a shopping spree *" << 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// time_t t=time(NULL); cout << "\t" << ctime(&t)<< endl << endl; //Displays the time// cout << "\t[]----------------------------------------------------------[]" << endl; cout << "\t||Congratulations! You have just won a $100 SHOPPING SPREE!!||" << endl; cout << "\t||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~||" << endl; cout << "\t|| ||" << endl; cout << "\t||Rules: The prices of items are in a range of $10 to $20 ||" << endl; cout << "\t|| only and you can only purchase items up until you reach ||" << endl; cout << "\t|| the $100 limit ||" << endl; cout << "\t[]----------------------------------------------------------[]" << endl; cout << endl; cout << " What is your first name?................: "; cin >> fname; cout << endl << endl; cout << " What is your last name?.................: "; cin >> lname; cout << endl << endl; start: cout << "\tWell " << fname << " " << lname << ", with this $100, you have to " << endl; cout << "\tpurchase items until you go over or reach the" << endl; cout << "\t$100 limit. So START BUYING!!!" << endl; getch(); items = 0; items1 = 0; while(items < 100) { cout << endl; count = count + 1; cout << "\tPlease enter the price: "; cin >> items; items1 = items1 + items; if(items < 10 | items > 20) { cout << "\t the Price is too low/high"; getch(); clrscr(); goto start; } if(items1 > 100) { goto start1; } } getch(); start1: clrscr(); cout << setiosflags(ios:: fixed); cout << setprecision(2); cout << ctime(&t)<< endl << endl; //Displays the time// cout << " \t\t\t Shoppers Paradise - Winners Circle" << endl; cout << " \t\t\t ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl << endl; cout << endl << endl << " Name of Contestant: " << fname << ", " << lname; cout << "\t\t Winners limit $100.00" << endl; cout << endl << endl << " Total Price of items won in shopping spree......:" << items1 << endl; cout << setprecision(0); cout << " Total count of items won in shopping spree......: "<< count << endl; cout << endl << endl; purchaseex = items1 - 100; cout << setprecision(2); cout << " Amount of last attempted purchase exceeding the limit...: $" << items << endl; cout << " Amount that exceeded the winners limit..................: $" << purchaseex<< endl; cout << endl << endl << endl << "\t\t-Thank You for Shopping @ Shoppers Paradise-"; return 0; }