-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass18.cpp
54 lines (49 loc) · 1 KB
/
class18.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;
class item{
char id[5],desc[20];
float price;
int qoh,re_qty;
public:
item() //constructor
{
qoh=0;price=0;re_qty=0;
}
void adddata();
void showdata();
};
void item::adddata() //scope resolution
{
cout<<"\n ENTER ITEM CODE:";
cin>>id;
cout<<"\n ENTER ITEM DESCRIPTION :";
cin>>desc;
cout<<"\n ENTER PRICE:";
cin>>price;
cout<<"\n ENTER QUANTITY :";
cin>>qoh;
cout<<"\n ENTER RE_ORDER QUANTITY: ";
cin>>re_qty;
}
void item::showdata()//scope resolution
{
cout<<"\nITEM CODE: "<<id;
cout<<"\nDESCIPTION:"<<desc;
cout<<"\nPRICE:"<<price;
cout<<"\nQUANTITY: "<<qoh;
cout<<"\nRE-ORDER QUANTITY : "<<re_qty<<endl;
}
int main()
{
item it;
char ch;
do{
cout<<"\nENTER THE ITEM DETAILS\n";
it.adddata();
cout<<endl;
it.showdata();
cout<<"DO YOU WANT TO CONTINUE: (y/n)\n";
cin>>ch;
}while(ch=='y');
return 0;
}