-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path23.cpp
48 lines (42 loc) · 838 Bytes
/
23.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
#include <iostream>
using namespace std;
class Shop
{
int itemID[100];
int itemPrice[100];
int counter;
public:
void initCounter(void)
{
counter = 1;
};
void DisplayPrice(void);
void setPrice(void);
};
void Shop ::setPrice(void)
{
cout << "Enter ID of your item" << endl;
cin >> itemID[counter];
cout << "Enter Price of your item" << endl;
cin >> itemPrice[counter];
counter++;
}
void Shop ::DisplayPrice(void)
{
for (int i = 1; i < counter; i++)
{
cout << "The price for item with ID " << itemID[i] << " is " << itemPrice[i] << endl;
}
}
int main()
{
Shop Dukaan;
Dukaan.initCounter();
Dukaan.setPrice();
Dukaan.setPrice();
Dukaan.setPrice();
Dukaan.setPrice();
Dukaan.setPrice();
Dukaan.DisplayPrice();
return 0;
}