Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <stdio.h>
- double PLN=0;
- float EURO;
- float US;
- int coffee;
- float change;
- double totalEUR;
- double totalUS;
- using namespace std;
- int main(int argc, char** argv) {
- cout << "Please choose one kind of coffee. There are 9 different kinds." << endl;
- cout << endl << endl;
- cout << "**********************" << endl;
- cout << "1. Latte" << endl << "2. Flat White" << endl << "3.Cappucino" << endl << "4.Mocha" << endl << "5.Americano" << endl << "6.Ice Coffee" << endl << "7.Latte Maccihiato" << endl << "8.Caramel Frappucino" << endl << "9.Espresso" << endl;
- cout << "**********************" << endl;
- cin >> coffee;
- EURO=PLN*4.171;
- US=PLN*3.40;
- switch (coffee){
- case 1:
- {
- cout << "You have chosen Latte. Please insert 5 PLN:" << endl;
- cin >> PLN || EURO || US;
- if (PLN==5)
- cout << "Thank you. Here's your coffee.";
- else if (PLN<5.0)
- cout << "Please insert more money. You have to put " << abs(change) << " more." << endl;
- else if (PLN>5.0)
- change=(5-PLN);
- cout << "Here's your change:" << abs(change);
- break;}
- case 2:
- {
- cout << "You have chosen Flat White. Please insert 6 PLN:" << endl;
- double totalPLN=6;
- while(totalPLN>0){
- cin>>PLN;da
- totalPLN-=PLN;
- if(PLN<=0)
- cout << "Thank's. Here's your coffee.";
- elsed
- cout << "Please insert " << totalPLN << " more." << "You have entered: " << PLN << " so far." << endl;
- }
- break;
- }
- case 3:
- {
- cout << "You have chosen Cappucino. Please insert 4.50 PLN:" << endl;
- cin >> PLN || EURO || US;
- if(PLN==4.5)
- cout << "Thank you. Here's your coffee.";
- else if (PLN<4.5)
- cout << "Please insert more money.";
- else if (PLN>4.5)
- cout << "Here's your change.";
- break;}
- case 4:
- {
- cout << "You have chosen Mocha. Please insert 6 PLN:" << endl;
- cin >> PLN || EURO || US;
- if(PLN==6.0)
- cout << "Thank you. Here's your coffee.";
- else double PLN=0;if (PLN<6.0)
- cout << "Please insert more money.";
- else if (PLN>6.0)
- cout << "Here's your change.";
- break;}
- case 5:
- {
- cout << "You have chosen Americano. Please insert 3.90 PLN:" << endl;
- cin >> PLN || EURO || US;
- if(PLN==3.9)
- cout << "Thank you. Here's your coffee.";
- else if (PLN<3.9)
- cout << "Please insert more money.";
- else if (PLN>3.9)
- cout << "Here's your change.";
- break;}
- case 6:
- {
- cout << "You have chosen Ice Coffee. Please insert 5 PLN:" << endl;
- cin >> PLN || EURO || US;
- if(PLN==5.0)
- cout << "Thank you. Here's your coffee.";
- else if (PLN<5.0)
- cout << "Please insert more money.";
- else if (PLN>5.0)
- cout << "Here's your change.";
- break;}
- case 7:
- {
- cout << "You have chosen Latte Maccihiato. Please insert 6.5 PLN:" << endl;
- cin >> PLN || EURO || US;
- if(PLN==6.5)
- cout << "Thank you. Here's your coffee.";
- else if (PLN<6.5)
- cout << "Please insert more money.";
- else if (PLN>6.5)
- cout << "Here's your change.";
- break;}
- case 8:
- {
- cout << "You have chosen Caramel Frappucino. Please insert 8 PLN:" << endl;
- cin >> PLN || EURO || US;
- if(PLN==8.0)
- cout << "Thank you. Here's your coffee.";
- else if (PLN<8.0)
- cout << "Please insert more money.";
- else if (PLN>8.0)
- cout << "Here's your change.";
- break;}
- case 9:
- {
- cout << "You have chosen Espresso. Please insert 4.20 PLN:" << endl;
- cin >> PLN || EURO || US;
- if(PLN==4.20)
- cout << "Thank you. Here's your coffee.";
- else if (PLN<4.2)
- cout << "Please insert more money.";
- else if (PLN>4.2)
- cout << "Here's your change.";
- break;}
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement