Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- struct Address {
- char city[50];
- char street[50];
- int number;
- int apartmentNumber;
- int floorNumber;
- };
- struct Student {
- int age;
- int mathMean;
- int number;
- Address workAddress;
- Address homeAddress;
- };
- struct Car {
- char color[20];
- int numberOfDoors;
- int numberOfWindows;
- int cylindricCapacity;
- char brand[30];
- char model[30];
- };
- int main() {
- struct Car myCar;
- int numbers[20];
- struct Car cars[3];
- for(int i = 0; i < 2; i++) {
- cout << "Enter car brand: ";
- char brand[15], model[15], color[20];
- cin >> brand;
- strcpy(cars[i].brand, brand);
- cout << "\nEnter car model: ";
- cin >> model;
- strcpy(cars[i].model, model);
- cout << "\nEnter color: ";
- cin >> color;
- strcpy(cars[i].color, color);
- cout << "\nEnter number of doors: ";
- cin >> cars[i].numberOfDoors;
- cout << "\nEnter number of windows: ";
- cin >> cars[i].numberOfWindows;
- cout << "\nEnter cc: ";
- cin >> cars[i].cylindricCapacity;
- }
- cout << "Available cars: \n\n";
- cout << "Brand\tModel\tColor\t#Doors\t#Windows\tCC\n";
- for(int i = 0; i < 2;i++) {
- cout <<cars[i].brand <<"\t" << cars[i].model << "\t" << cars[i].color << "\t" << cars[i].numberOfDoors << "\t" << cars[i].numberOfWindows << "\t" << cars[i].cylindricCapacity;
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement