-
Notifications
You must be signed in to change notification settings - Fork 0
/
tut23.cpp
55 lines (44 loc) · 886 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
55
#include <iostream>
using namespace std;
class shop
{
private:
int itemid[100];
int itemprice[100];
int counter;
public:
void initcounter(void)
{
counter = 0;
}
void setprice(void);
void getprice(void);
};
void shop ::setprice(void)
{
cout << "enter the id for the item no " << counter + 1 << endl;
cin >> itemid[counter];
cout << "Enter the price of the item " << endl;
cin >> itemprice[counter];
counter++;
}
void shop::getprice(void)
{
for (int i = 0; i < counter; i++)
{
/* code */
cout << "The item price for item no " << itemid[i] << " is " << itemprice[i] << endl;
}
}
int main()
{
shop dukan;
dukan.initcounter();
dukan.setprice();
dukan.setprice();
dukan.setprice();
dukan.setprice();
dukan.setprice();
dukan.getprice();
return 0;
}