Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct car{
- string brand_name;
- string model;
- int production_date;
- int distance_passed;
- car(){
- // empty constructor / default construcotr
- }
- car(string _brand_name, string _model, int _production_date, int _distance_passed) {
- brand_name = _brand_name;
- model = _model;
- production_date = _production_date;
- distance_passed = _distance_passed;
- }
- };
- int main() {
- int n;
- cin >> n;
- car cars[n];
- for(int i = 0; i < n; i++) {
- cin >> cars[i].brand_name >> cars[i].model >> cars[i].production_date >> cars[i].distance_passed;
- }
- for(int i = 0; i < n; i++) {
- cout << cars[i].brand_name << " " << cars[i].model << " " << cars[i].production_date << " " << cars[i].distance_passed << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement