Sunday, January 26, 2014

C++ Program to illustrate Class Implementation

with 0 Comment
C++ Program to illustrate Class Implementation:

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
class item
{
int number;
float cost;
public:
void getdata(int a,float b);
void putdata(void)
{
cout<<"Number:"<<number<<"\n";
cout<<"cost:"<<cost<<"\n";
}
};
void item::getdata(int a,float b)
{
number=a;
cost=b;
}
int main()
{
item x;
clrscr();
cout<<"\n Object x"<<"\n";
x.getdata(100,299.75);
x.putdata();
item y;
cout<<"\n Object y"<<"\n";
y.getdata(200,175.5);
y.putdata();
getch();
return(0);
}

0 comments:

Post a Comment

Powered by Blogger.

Blog Archive