📄 test.cpp
字号:
#include<iostream.h>
struct car{
char maker[20];
int year;
};
void main()
{
int a;
cout<<"有多少辆车?";
cin>>a;
cin.get();
car * p=new car[a];
for(int i=0;i<a;i++)
{
cout<<"Car #"<<(i+1)<<":"<<endl;
cout<<"please enter the maker:";
cin.getline(p[i].maker,20);
cout<<"please enter the year made:";
cin>>(p[i].year);
cin.get();
}
cout<<"here is your collection:\n";
for(int j=0;j<a;j++)
cout<<p[j].year<<" "<<p[j].maker<<endl;
delete [] p;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -