-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtut23.cpp
54 lines (49 loc) · 960 Bytes
/
tut23.cpp
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
#include<iostream>
using namespace std;
void name()
{
cout<<'Author: Varun Gupta'<<endl;
}
class shop
{
int itemID[100];
int itemPRICE[100];
int counter;
public:
void initcounter()
{
counter=0;
}
void setprice();
void display();
};
void shop:: setprice()
{
int t;
cout<<"Enter the no of items you want to include in your shop "<<endl;
cin>>t;
for(int c=0;c<t;c++)
{
cout<<"Enter the ID of your item no: " <<counter+1<<endl;
cin>>itemID[counter];
cout<<"Enter the price of your item: "<<endl;
cin>>itemPRICE[counter];
counter++;
}
}
void shop:: display()
{
for(int i=0;i<counter;i++)
{
cout<<"The Price of the item with ID "<<itemID[i]<<" is "<<itemPRICE[i]<<endl;
}
}
int main()
{
name();
shop n;
n.initcounter();
n.setprice();
n.display();
return 0;
}