-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path21npractise.cpp
More file actions
46 lines (39 loc) · 847 Bytes
/
Copy path21npractise.cpp
File metadata and controls
46 lines (39 loc) · 847 Bytes
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
#include <iostream>
using namespace std;
class shop
{
int itemID[100];
int itemPrice[100];
int counter;
public:
void initcounter(void) { counter = 0; }
void setPrice(void);
void getPrice(void);
void displayPrice(void);
};
void shop ::setPrice(void)
{
cout << "entre Id of your item no " << counter + 1 << endl;
cin >> itemID[counter];
cout << "entre the price of your item " << endl;
cin >> itemPrice[counter];
counter++; // to get to item number 2 or 3
};
void shop ::displayPrice(void)
{
initcounter();
for (int i = 0; i < 4; i++)
{
setPrice();
}
for (int i = 0; i < counter; i++)
{
cout << "the Price of item with Id " << itemID[i] << " is " << itemPrice[i] << endl;
}
}
int main()
{
shop BitCoin;
BitCoin.displayPrice();
return 0;
}