Created
June 18, 2020 10:24
-
-
Save 2hanX/b13dbbf75a89bacedffd76e6253b002e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
using namespace std; | |
struct Car | |
{ | |
string build; | |
int year; | |
}; | |
int main() | |
{ | |
int cars; | |
cout << "How many cars do you wish to catalog? "; | |
cin >> cars; | |
cin.get(); | |
Car *car = new Car[cars]; | |
for (int i = 0; i < cars; i++) | |
{ | |
cout << "Car #" << i+1 << ":\n"; | |
cout << "Please enter the make: "; | |
getline(cin, car[i].build); | |
cout << "Please enter the year made: "; | |
cin >> car[i].year; | |
cin.get(); | |
} | |
cout << "Here is your Hornet" << endl; | |
for (int j = 0; j < cars; j++) | |
{ | |
cout << car[j].year << " " << car[j].build << endl; | |
} | |
delete[] car; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment