-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.cpp
More file actions
67 lines (66 loc) · 1.43 KB
/
code.cpp
File metadata and controls
67 lines (66 loc) · 1.43 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
#include <iostream>
#include <string>
using namespace std;
int main(){
int count;
float price = 1.0;
bool Bool = false;
string name;
int flag = 1;
cout<<"Enter product name:"<<endl;
cin>>name;
cout<<"Enter the price of the product:"<<endl;
cin>>price;
cout<<"Enter the quantity of the product: "<<endl;
cin>>count;
while(flag!=0){
cout<<"1. Find out information about the current product"<<endl;
cout<<"2. Find out the total cost"<<endl;
cout<<"3. Change the quantity of the product and its price"<<endl;
cout<<"4. Display product list"<<endl;
cout<<"5. Block/unblock access to functions"<<endl;
cout<<"6. Exit"<<endl;
cin>>flag;
if(flag==1){
if(Bool){
cout<<"Name: "<<name<<endl;
cout<<"Price: "<<price<<endl;
cout<<"Count: "<<count<<endl;
}
else{cout<<"Access blocked"<<endl;}
}
else if (flag==2){
if(Bool){
cout<<price*count<<endl;
}
else{cout<<"Access blocked"<<endl;}
}
else if (flag==3){
if(Bool){
cout<<"Enter new count: "<<endl;
cin>>count;
cout<<"Enter new price: "<<endl;
cin>>price;
}
else{cout<<"Access blocked"<<endl;}
}
else if (flag==4){
if(Bool){
for(int i=0;i<count;i=i+1){
cout<<i+1<<": "<<name<<endl;
}
}
else{cout<<"Access blocked"<<endl;}
}
else if(flag==5){
if(Bool){
Bool=false;}
else{
Bool=true;}
}
else{
flag=0;
}
}
return 1;
}