请各位前辈指导

443692487 443692487 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在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;

}
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
443692487
C++ 语言 65,214 成员 250,514 内容