请各位前辈指导
我在vc6.0里面输入这个程序,为什么运行结果总是不对呢
#include "iostream"
#include "string"
using namespace std;
struct Car{
string maker;
int year;
};
int main(){
int count;
cout<<"How many cars do you wish to catalog? ";
cin>>count;
Car *car;
car = new Car[count];
for (int i = 0;i<count;i++){
cout<<"car #"<<(i+1)<<":"<<endl;
cout<<"Please enter the maker : ";
getline(cin,car[i].maker);
cout<<"Please enter the year made: ";
cin>>car[i].year;
cout<<endl;
}
cout<<"Here is your collection : "<<endl;
for (int j = 0;j<count;j++){
cout<<car[j].year<<"\t"<<car[j].maker<<endl;
}
delete []car;
return 0;
}