CoCaCola Machine

Is my learning Code Going good. I created an cocacola machine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int yourmoney = 50000;
    int x;
    int b1=500,b2=400,b3=450,b4=600,b5=350;
    cout << "Welcome to Cola Machine!   Press what you want to buy!" << endl;
    cout << "You have :"<< yourmoney<<"$"<<endl;
    cout << "1. CocaCola"<<"  Cost:"<< b1<< endl;
    cout << "2. Fanta"<<"  Cost:"<<b2<< endl;
    cout << "3. Pepsi"<<"  Cost:"<<b3<< endl;
    cout << "4. Bravo"<<"  Cost:"<<b4<< endl;
    cout << "5. Ivi"<<"  Cost:"<<b5<< endl;
    cin >>x;
    cout<<endl;


    if(x==1)
    {
      cout << "You bought CocaCola for:"<<b1<<"$"<< endl;
      yourmoney = yourmoney - b1;
      cout << "Money left:"<<yourmoney<<endl;
      cout<<endl;
    }
    else if (x==2)
    {
        cout << "You bought Fanta"<<b2<<"$"<< endl;
        yourmoney = yourmoney - b2;
        cout << "Money left:"<<yourmoney<<endl;
        cout<<endl;
    }
    else if (x==3)
    {
        cout << "You bought Pepsi"<<b3<<"$"<< endl;
        yourmoney = yourmoney - b3;
        cout << "Money left:"<<yourmoney<<endl;
        cout<<endl;
    }
    else if (x==4)
    {
        cout << "You bought Bravo"<<b4<<"$"<< endl;
        yourmoney = yourmoney - b4;
        cout << "Money left:"<<yourmoney<<endl;
        cout<<endl;
    }
    else if (x==5)
    {
        cout << "You bought Ivi"<<b5<<"$"<< endl;
        yourmoney = yourmoney - b5;
        cout << "Money left:"<<yourmoney<<endl;
        cout<<endl;
    }
    cout<<endl;
    cout << "Thanks for buying on CoCaCola Machine!"<< endl;
    return 0;
}

Looks great! I'm super new as well, you are even a little more experienced than I am. All I've done is make a Hello World and Gas Calculator, hehehe.. I like what you did here though. I know most of this syntax and it has inspired me to make something of my own instead of just following a tutorial!
Topic archived. No new replies allowed.