Need Help in multiply total by 10%

//Hello guys... I'm new to here... I want to create multiply 10% as topic says, posted my code as follows

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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <iostream>
#include <conio.h>
#include <iomanip>
using namespace std;

void menu();
void print_bill();

const double price_pizza = 19.99;

int quantity_pizza = 0;

int main()
{
	char my_input;

	while (1)
	{ system("cls");

    cout <<"Please select an action:" << endl;
	cout <<"[1]. Food Menu" << endl;
	cout <<"[0]. Exit" << endl;
	my_input = _getch();

	if (my_input == '1' )
	{
		menu();
	}

    
	if (my_input == '0' )
	{
		break;
	}
}
}

void menu ()
{
	   char input1;
	   system("cls");
       cout << endl;

	   while (1)
	   {
       cout <<" [1]. Pizza" << endl;
       cout <<" [8]. Main Menu" << endl;
       cout <<" [0]. Bill" << endl;
       cout << endl;

       int my_input, quantity;
       cout <<"Please select a menu:";
       my_input = _getch();

       if (my_input == '1' )
       {
            cout <<" Pizza" << endl;
       }
  
       else if (my_input == '8' )
       {
            break;
       }

       else if (my_input == '0' )
       {
           print_bill();
           break;
       }

       cout <<" Your Quantity:" << endl;
       cin >> quantity;

	   system("cls");

       if (my_input == '1' )
       {
            quantity_pizza += quantity;
       }
    }
}

void print_bill()
{
		
	   char input0;
	   system("cls");
	   cout << endl;
       cout << setfill(' ') << setw(2) << left << " Pizza ";
       cout << setfill(' ') << setw(10) << left << price_pizza;
       cout << setfill(' ') << setw(10) << left << quantity_pizza;
       cout << setfill(' ') << setw(10) << left << price_pizza * quantity_pizza;
       cout << endl;

      // cout << setfill(' ') << setw(6) << left << 'Add On 10% GST ';
     //  cout << setfill(' ') << setw(2) << left << price_pizza * quantity_pizza * 10%;
      // cout << endl;

       cout <<"Press any key back to the main menu" << endl;
       _getch();
}


//So.. My question is .. how to calculate the total amount of 10% GST ?
Last edited on
Hi,
What is the assignment you are trying to solve?
Actually I'm done solving my assignment...

I'm just want to add some feature about * 6% to get the amount, add on to the sub total and finally find out the grand total...
C++ doesn't let you specify percentages directly. You have to use the decimal equivalent.
10% is 0.10, so at line 96, just replace 10% with 0.10. The grand total is 110% of the price: price_pizza*quantity_pizza*1.10.
Topic archived. No new replies allowed.