Advertisement
Josif_tepe

Untitled

Oct 23rd, 2024
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 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.    
  13.     void print() {
  14.         cout << "Model: " << model << endl;
  15.         cout << "Make: " << make << endl;
  16.         cout << "First registration year: " << first_registration << endl;
  17.         cout << "Passed " << km << " km" << endl;
  18.        
  19.         if(damage == 0) {
  20.             cout << "The car has not been in a car accident" << endl;
  21.         }
  22.         else {
  23.             cout << "The car has been in a car accident" << endl;
  24.         }
  25.     }
  26.    
  27. };
  28.  
  29. int main() {
  30.    
  31.     Avtomobil m;
  32.     m.model = "mercedes";
  33.     m.make = "S class";
  34.     m.first_registration = 2020;
  35.     m.km = 2000;
  36.     m.damage = 0;
  37.    
  38.     m.print();
  39.    
  40.  
  41.     return 0;
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement