I had this problem last night. (http://www.cprogramming.com/cboard/s...threadid=12648).
But what worked then, doesn't seem to work now: on the 2nd cin it skips the getline and propts for "make". Sorssen (I think) suggested input.ignore() to skip the '/n' in the buffer, but it's not working now.
I'll attach the whole prog if that helps, thanks in advance
Code:
istream& operator>>(istream& input, cars& c)
{
cout<<"Make ";
input.getline(c.make,10);
cout<<"model ";
input.getline(c.model,10);
cout<<"capacity ";
input>>c.cpcty;
cout<<"price ";
input>>c.price;
input.ignore();
return(input);
};
ostream& operator<<(ostream& oput, cars& c)
//....
main()
{
cars car1;
cars car2;
cars car3;
cars car4;
cin>>car1;
cin>>car2;
cin>>car3;
cin>>car4;
cout<<car1;
cout<<car2;
cout<<car3;
cout<<car4;
return (0);
}