hi everyone
i have written a simple program which asks for the colour and no of wheels of a vehicle.
i used gets() for inputting colour of vehicle.but it was skipping that line.
some body suggested me that it is buffer problem and use cin.getline() with getchar() function in while loop.but still i am unable to input colour from user please help...
thanks in advance
void two_wheeler::getdata()
{
vehicle::getdata();/*this is the base class function*/
cout<<"enter colour"<<endl;
getline(colour,sizeof(colour));/* the variable colour does not get value when user gives input */
while(getchar()!= '\n');
cout<<"enter no. of wheels"<<endl;
cin>>noofwheels;
}