Cars

From Rock3r, 9 Years ago, written in C++, viewed 682 times.
URL https://paste.godclan.hu/view/e0B3Y5xi Shorturl Error: Input provided by user is not valid Embed
Download Paste or View Raw
  1. /*
  2.    auto -->  markanev,model
  3.        tipus --> model neve,kiadas eve,motor tipusa
  4.        motor --> motor tipusa[benzin/diesel/gaz],kobcenti,loero
  5.    3auto --> 100loero feletti es legidosebb
  6. */
  7.  
  8. #include <cstdlib>
  9. #include <iostream>
  10. #include <string>
  11.  
  12. using namespace std;
  13.  
  14. struct motor {
  15.           string motor;
  16.           int kob;
  17.           int loero;
  18.        };
  19. struct tipus {
  20.           string mnev;
  21.           int kiadas;
  22.           motor mtipus;
  23.        };
  24.        
  25. struct autoo{
  26.           string marka;
  27.           tipus model;
  28.        };
  29.            
  30. using namespace std;
  31.  
  32. int main(int argc, char *argv[])
  33. {
  34.     int feletti[3];
  35.     int alatti[3];
  36.     int oreg[3];
  37.     int fiatal[3];
  38.     int min = 500;
  39.     int max;
  40.    
  41.     autoo a[3];
  42.    
  43.     for(int i = 0; i < 3; i++ ){
  44.        cout << "[" << i + 1 << "]Auto -> markaja[s]: ";    
  45.        cin >> a[i].marka;
  46.       cout << "[" << i + 1 << "]Auto -> model -> neve[s]: ";
  47.        cin >> a[i].model.mnev;
  48.        cout << "[" << i + 1 << "]Auto -> model -> kiadas[i]: ";
  49.        cin >> a[i].model.kiadas;
  50.        cout << "[" << i + 1 << "]Auto -> model -> motor -> mtipus[s]: ";  
  51.        cin >> a[i].model.mtipus.motor;
  52.        cout << "[" << i + 1 << "]Auto -> model -> motor -> kob[i]: ";
  53.        cin >> a[i].model.mtipus.kob;
  54.        cout << "[" << i + 1 << "]Auto -> model -> motor -> loero[i]: ";
  55.        cin >> a[i].model.mtipus.loero;
  56.     }
  57.     system("cls");
  58.     cout << "adatok" << endl;
  59.     for ( int i = 0; i < 3; i++ ) {
  60.        cout << "Auto -> marka: ";
  61.        cout << a[i].marka;
  62.        cout<<endl;
  63.        cout << "Auto -> model -> neve[s]: ";
  64.        cout << a[i].model.mnev;
  65.        cout<<endl;
  66.        cout << "Auto -> model -> kiadas[i]: ";
  67.        cout << a[i].model.kiadas;
  68.        cout<<endl;
  69.        cout << "Auto -> model -> motor -> mtipus[s]: ";  
  70.        cout << a[i].model.mtipus.motor;
  71.        cout<<endl;
  72.        cout << "Auto -> model -> motor -> kob[i]: ";
  73.        cout << a[i].model.mtipus.kob;
  74.        cout<<endl;
  75.        cout << "Auto -> model -> motor -> loero[i]: ";
  76.        cout << a[i].model.mtipus.loero;
  77.        cout<<endl;
  78.          
  79.     }
  80.    
  81.     for ( int i = 0; i < 3; i++ ) {
  82.         if ( a[i].model.mtipus.loero > 100 ) {
  83.             feletti[i] = i;    
  84.         }
  85.         else {
  86.             alatti[i] = i;
  87.         }
  88.         if ( a[i].model.kiadas > min ) {
  89.             min = i;
  90.         }    
  91.     }
  92.     cout << endl << endl;;
  93.     for ( int i = 0; i < 3; i++ ) {
  94.         cout << "100loerotol nagyobbak: " << endl;
  95.         cout << "Marka: " << a[feletti].marka << " Modell: " << a[feletti].model.mnev;
  96.         cout << endl << endl;
  97.        
  98.            
  99.     }
  100.     cout << "Legidosebb: " << endl;
  101.     cout << "Marka: " << a[min].marka << " Modell: " << a[min].modell.mnev;
  102.    
  103.     system("PAUSE");
  104.     return EXIT_SUCCESS;
  105. }
  106.  

Reply to "Cars"

Here you can reply to the paste above