Advertisement
Josif_tepe

Untitled

Oct 23rd, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Avtomobil {
  5.  
  6.     string model;
  7.     string make;
  8.     int first_registration;
  9.     int km;
  10.     int damage;
  11.    
  12.     void input() {
  13.         cin >> model >> make >> first_registration >> km >> damage;
  14.     }
  15.     void print() {
  16.         cout << "Model: " << model << endl;
  17.         cout << "Make: " << make << endl;
  18.         cout << "First registration year: " << first_registration << endl;
  19.         cout << "Passed " << km << " km" << endl;
  20.        
  21.         if(damage == 0) {
  22.             cout << "The car has not been in a car accident" << endl;
  23.         }
  24.         else {
  25.             cout << "The car has been in a car accident" << endl;
  26.         }
  27.     }
  28.    
  29. };
  30.  
  31. int main() {
  32.    
  33.     Avtomobil m;
  34.     m.input();
  35.    
  36.     m.print();
  37.    
  38.  
  39.     return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement