-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbillcalculator.cpp
More file actions
70 lines (49 loc) · 1.52 KB
/
Copy pathbillcalculator.cpp
File metadata and controls
70 lines (49 loc) · 1.52 KB
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
/*“I built a console-based billing app for cafés or small shops. It includes item selection, quantity input,
GST calculation, and final bill generation. The idea came from local vendors who still use calculators.
I coded it using C++ control structures and tested various item combos.*/
#include<iostream>
using namespace std;
string menu[5];
int quant[5];
int i;
int j;
int main(){
cout<<"select items from the menu : ";
for(i=0; i<5 ; i++){
cin>>menu[i];
}
for(i=0; i<5 ; i++){
cout<<"item "<<i+1<<":" <<menu[i]<<endl;
}
cout<<"enter the quantity of every item in menu :"<<endl;
for(j=0; j<5; j++){
cin>>quant[j];
}
for(i=0; i<5 ; i++){
cout<<menu[i]<<" : " <<quant[i]<<endl;
}
int priceforone[5] ;
for(i=0; i<5; i++){
cout<<"--- price for--"<<menu[i]<<":";
cin>>priceforone[i];
cout<<"--- price for--"<<menu[i]<<":"<<priceforone[i]<<endl;
cout<<"total price :"<<(priceforone[i] * quant[i])<<endl;
}
int total =0;
int bill[5];
for(i=0;i<5;i++){
bill[i]=0;
bill[i] = (priceforone[i] * quant[i]);
cout<<bill[i]<<endl;
}
float GST[5];
cout<<"GST per item is 0.80% of the price of item "<<endl;
for(i=0;i<5;i++){
GST[i]=0;
GST[i] = (0.80/100)*bill[i];
cout<<GST[i]<<endl;
total += bill[i] + GST[i];
}
cout<<total;
return 0;
}