Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. struct car
  8. {
  9.     car(string m,string mo,string ro,string po);
  10.     void opel();
  11.     void Ford();
  12. private:
  13.     string marka;
  14.     string model;
  15.     string rocznik;
  16.     string pojemnosc;
  17.    
  18. };
  19. car::car(string m, string mo, string ro, string po)
  20. {
  21.     marka = m;
  22.     model = mo;
  23.     rocznik = ro;
  24.     pojemnosc = po;
  25. }
  26. void car::Ford()
  27. {
  28.     cout << "marka to" << marka << ", model to " << model << ", rocznik to " << rocznik;
  29. }
  30. void car::opel()
  31. {
  32.    
  33.     cout << "marka to" << marka << ", model to " << model << ", rocznik to " << rocznik;
  34.    
  35. }
  36. int main()
  37. {
  38.     int odp;
  39.     cout << "[1] OPEL" << endl;
  40.     cout << "[2]Ford" << endl;
  41.     cin >> odp;
  42.     switch(odp)
  43.     {
  44.     case 1:
  45.     {
  46.         car
  47.             opel("opel", "corsa", "1914", "20");
  48.         opel.opel();
  49.         break;
  50.     }
  51.     case 2:
  52.     {
  53.         car
  54.             opel("f", "1", "2311", "211");
  55.         ford.ford();
  56.         break;
  57.     }
  58.  
  59.  
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement