#include <iostream>
#include <vector>
using namespace std;
int main()
{
struct shu
{
string mader;
int year;
};
int n;
cout<<"How many cars do you wish to catalog?";
cin>>n;
cin.get();
shu *car=new shu[n];
for (int i=1;i<=n;i++)
{
cout<<"Car #"<<i<<":\n";
cout<< "Please enter the make:";
getline(cin,car[i-1].mader);
cout <<"Please enter the year made:";
cin>>car[i-1].year;
cin.get();
}
cout <<"Here is your collection:\n";
for (int i=1;i<=n;i++)
{
cout <<car[i-1].year<<" "<<car[i-1].mader;
cout<<"\n";
}
return 0;
}
#include <vector>
using namespace std;
int main()
{
struct shu
{
string mader;
int year;
};
int n;
cout<<"How many cars do you wish to catalog?";
cin>>n;
cin.get();
shu *car=new shu[n];
for (int i=1;i<=n;i++)
{
cout<<"Car #"<<i<<":\n";
cout<< "Please enter the make:";
getline(cin,car[i-1].mader);
cout <<"Please enter the year made:";
cin>>car[i-1].year;
cin.get();
}
cout <<"Here is your collection:\n";
for (int i=1;i<=n;i++)
{
cout <<car[i-1].year<<" "<<car[i-1].mader;
cout<<"\n";
}
return 0;
}