Aim:
Write a program that uses the class where the member function are defined
inside the class?
#include<iostream.h>
#include<conio.h>
class car
{
private:char
color[20],model[20];
float cost;
public:void
get()
{
cout<<"Enter
Color,Model no & Cost\n";
cin>>color>>model>>cost;
}
void out()
{
cout<<"\tColor="<<color<<"\n"<<"\tModel="<<model<<"\n"<<"\tCost="<<cost;
}
};
void main()
{
class car c;
clrscr();
c.get();
c.out();
getch();
}
No comments:
Post a Comment