Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- /* Name: totalpurchase.cpp
- Program that shows total purchase.
- NIGHT THE FAGGOT
- */
- int main()
- {
- float price1,price2,price3,price4,price5,subtotal,tax,total;
- int salestax;
- string Answer;
- do
- {
- cout<<"Enter price of first item." <<endl;
- cin>>price1;
- cout<<"Enter price of second item." <<endl;
- cin>>price2;
- cout<<"Enter price of third item." <<endl;
- cin>>price3;
- cout<<"Enter price of fourth item." <<endl;
- cin>>price4;
- cout<<"Enter price of fifth item." <<endl;
- cin>>price5;
- subtotal = price1 + price2 + price3 + price4 + price5;
- cout<<"Enter sales tax." <<endl;
- cin>>salestax;
- tax = (subtotal * salestax / 100);
- total = subtotal + tax;
- cout<<"Your total purchase is:" <<endl;
- cout<<"Item 1 - $" <<price1 <<endl;
- cout<<"Item 2 - $" <<price2 <<endl;
- cout<<"Item 3 - $" <<price3 <<endl;
- cout<<"Item 4 - $" <<price4 <<endl;
- cout<<"Item 5 - $" <<price5 <<endl;
- cout << endl;
- cout <<"Subtotal - $" <<subtotal <<endl;
- cout <<"Tax - $" <<tax <<endl;
- cout <<"Total - $" <<total <<endl;
- cout<<"Do you wish to continue?(y/n)"<<endl;
- cin>>Answer;
- } while ( Answer != "N" && Answer != "n");
- return 0;
- }//end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement