MasterGun

Untitled

Oct 11th, 2020 (edited)
58
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class GPU {
  2.  
  3. public:
  4.     string model;
  5.     void showdata() {
  6.         cout << model << endl;
  7.     }
  8. };
  9. class CPU {
  10. public:
  11.     string model_name;
  12.     void showdata() {
  13.         cout << model_name << endl;
  14.     }
  15. };
  16. class Compukter {
  17. public:
  18.     GPU gpu;
  19.     CPU cpu;
  20.     void setdata(GPU _gpu, CPU _cpu) {
  21.         gpu = _gpu;
  22.         cpu = _cpu;
  23.     }
  24.     void showdata() {
  25.         cout << gpu.model << endl;
  26.         cout << cpu.model_name << endl;
  27.     }
  28. };
  29.  
  30. int main()
  31. {
  32.     setlocale(LC_ALL, "rus");
  33.     string modele1 = "PowerPC G5";
  34.     string modele2 = "Radeon 5500";
  35.     Compukter c1;
  36.     c1.cpu.model_name = modele1;
  37.     c1.gpu.model = modele2;
  38.     c1.showdata();
  39.     return 0;
  40. }
RAW Paste Data