#include<iostream.h>
#include<conio.h>
class item
{
private:
int number;
float cost;
public:
void getdata(int a,float b);
void putdata(void)
{
cout<<"number "<<number<<endl;
cout<<"cost "<<cost<<endl;
}
};
void item :: getdata(int a, float b)
{
number = a;
cost = b ;
}
int main()
{
clrscr();
item x;
x.getdata(20,30);
x.putdata();
item y;
y.getdata(30,4.32);
y.putdata();
getch();
return 0;
}
#include<conio.h>
class item
{
private:
int number;
float cost;
public:
void getdata(int a,float b);
void putdata(void)
{
cout<<"number "<<number<<endl;
cout<<"cost "<<cost<<endl;
}
};
void item :: getdata(int a, float b)
{
number = a;
cost = b ;
}
int main()
{
clrscr();
item x;
x.getdata(20,30);
x.putdata();
item y;
y.getdata(30,4.32);
y.putdata();
getch();
return 0;
}