|
Hello friends,
I am having problem while running below program.
If anyone can help me....
// create class car
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
// class declaration
class car
{
//data member
private:
char *c_nm;
char *color;
int model;
float price;
//member function
public:
void getcar(int n,char *nm,float p)
{
model=n;
c_nm=nm;
color=c;
price=p;
}
void putcar()
{
cout<<endl<<"model :="<<model;
cout<<endl<<"name :="<<c_nm;
cout<<endl<<"color :="<<color;
cout<<endl<<"price :="<<price;
}
};
void main()
{
int i;
char *nm1;
char *c1;
float p1;
clrscr();
car c11; //object of class
cout<<"enter model:=";
cin>>i;
cout<<"enter name:=";
cin>>nm1;
cout<<"enter color:=";
cin>>c1;
cout<<"enter price:=";
cin>>p1;
c11.getcar(i,nm1,p1);
c11.putcar();
getch();
}
|
|
|
|
|
|
|
// |