请各位前辈指导
我在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;
}
#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;
}
...全文
相关推荐
果蝇算法原始论文已经刊登-果蠅最佳化演算法_簡體版.pdf
果蝇算法原始论文已经刊登-果蠅最佳化演算法_簡體版.pdf 请各位前辈注意: 台湾学者潘文超老师的果蝇算法原始论文已经刊登, 没有麦片点数的可以上网下载. 附上原始论文及果蝇书籍让各位下载, 麻烦请转寄并通知大家!
winform打印
winform支付牌固定二维码位置打印,如有不足请各位前辈大侠指教
ios-仿KEEP应用引导页 3DTouch.zip
闲暇的时候写了个仿keep的引导页,请各位前辈批评指正。 源码地址:https://github.com/sunjinshuai/KeepGuidePage 如果,你觉着不错的话,请给一个star。
万能查杀病毒软件需要特征码
这个自己改良的版本有问题请联系,本人刚接触编程时间不多希望各位前辈多多的指教谢谢
果蝇算法书籍及相关论文-基于FOA_RBF神經網絡的外貿出口預測.pdf
果蝇算法书籍及相关论文-基于FOA_RBF神經網絡的外貿出口預測.pdf 最近有许多学者找晚辈索取果蝇算法书籍, 晚辈再次把它放在论坛上, 麻烦各位前辈有空请下载下来, 转交给同志朋友及学生!! 吴文


