Advertisement
alexdmin

10.1c#

May 24th, 2021
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. class ProgLanguage
  7. {
  8.     string Name;    // название языка
  9.     bool LowLevel; // является ли низкоуровневым
  10.     bool Multiparadigm; // является ли мультипарадигмальным (можно писать программы в рамках нескольких парадигм программирования)
  11.     bool Compiled; // является ли язык компилируемым
  12.     bool StaticallyTyped; // является ли язык статически типизированным (Каждая сущность в программе (переменная, функция и пр.) имеет свой тип, и этот тип определяется на момент компиляции)
  13.     bool ObjectOriented; // является ли язык объектно-ориентированным
  14. public:
  15.     ProgLanguage()
  16.     {
  17.         this->Name = "";
  18.         this->LowLevel = false;
  19.         this->Multiparadigm = false;
  20.         this->Compiled = false;
  21.         this->StaticallyTyped = false;
  22.         this->ObjectOriented = false;
  23.     }
  24.     string getName()
  25.     {
  26.         return Name;
  27.     }
  28.     bool getLowLevel()
  29.     {
  30.         return LowLevel;
  31.     }
  32.     bool getMultiparadigm()
  33.     {
  34.         return Multiparadigm;
  35.     }
  36.     bool getCompiled()
  37.     {
  38.         return Compiled;
  39.     }
  40.     bool getStaticallyTyped()
  41.     {
  42.         return StaticallyTyped;
  43.     }
  44.     bool getObjectOriented()
  45.     {
  46.         return ObjectOriented;
  47.     }
  48.     void setName(string Name)
  49.     {
  50.         this->Name = Name;
  51.     }
  52.     void setLowLevel(bool LowLevel)
  53.     {
  54.         this->LowLevel = LowLevel;
  55.     }
  56.     void setMultiparadigm(bool Multiparadigm)
  57.     {
  58.         this->Multiparadigm = Multiparadigm;
  59.     }
  60.     void setCompiled(bool Compield)
  61.     {
  62.         this->Compiled = Compield;
  63.     }
  64.     void setStaticallyTyped(bool StaticallyTyped)
  65.     {
  66.         this->StaticallyTyped = StaticallyTyped;
  67.     }
  68.     void setObjectOriented(bool ObjectOriented)
  69.     {
  70.         this->ObjectOriented = ObjectOriented;
  71.     }
  72.     void printName()
  73.     {
  74.         cout << "Language name: " << Name << endl;
  75.     }
  76.     void printLowLevel()
  77.     {
  78.         if (LowLevel)
  79.         {
  80.             cout << "Is a low-level language" << endl;
  81.         }
  82.         else
  83.         {
  84.             cout << "Is not a low-level language" << endl;
  85.         }
  86.     }
  87.     void printMultiparadigm()
  88.     {
  89.         if (Multiparadigm)
  90.         {
  91.             cout << "Language is multiparadigm" << endl;
  92.         }
  93.         else
  94.         {
  95.             cout << "Language is not multiparadigm" << endl;
  96.         }
  97.     }
  98.     void printCompiled()
  99.     {
  100.         if (Compiled)
  101.         {
  102.             cout << "Language is compiled" << endl;
  103.         }
  104.         else
  105.         {
  106.             cout << "Language is not compiled" << endl;
  107.         }
  108.     }
  109.     void printStaticallyTyped()
  110.     {
  111.         if (StaticallyTyped)
  112.         {
  113.             cout << "Language is statically typed" << endl;
  114.         }
  115.         else
  116.         {
  117.             cout << "Language is not compiled" << endl;
  118.         }
  119.     }
  120.     void printObjectOriented()
  121.     {
  122.         if (ObjectOriented)
  123.         {
  124.             cout << "Language is objectoriented" << endl;
  125.         }
  126.         else
  127.         {
  128.             cout << "Language is not object oriented " << endl;
  129.         }
  130.     }
  131. };
  132.  
  133. class C : public ProgLanguage
  134. {
  135.     int CreationDate; // 1969
  136. public:
  137.     C()
  138.     {
  139.         this->CreationDate = 0;
  140.     }
  141.     C(int CreationDate)
  142.     {
  143.         this->CreationDate = CreationDate;
  144.     }
  145.     int getCreationDate(int CreationDate)
  146.     {
  147.         return CreationDate;
  148.     }
  149.     void setCreationDate(int CreationDate)
  150.     {
  151.         this->CreationDate = CreationDate;
  152.     }
  153.     void printCreationDate()
  154.     {
  155.         cout << "Creation date is " << CreationDate << endl;
  156.     }
  157. };
  158. class Cpp : public ProgLanguage
  159. {
  160.     int CreationDate; //1985
  161. public:
  162.     Cpp()
  163.     {
  164.         this->CreationDate;
  165.     }
  166.     Cpp(int CreationDate)
  167.     {
  168.         this->CreationDate = CreationDate;
  169.     }
  170.     int getCreationDate(int CreationDate)
  171.     {
  172.         return CreationDate;
  173.     }
  174.     void setCreationDate(int CreationDate)
  175.     {
  176.         this->CreationDate = CreationDate;
  177.     }
  178.     void printCreationDate()
  179.     {
  180.         cout << "Creation date is " << CreationDate << endl;
  181.     }
  182. };
  183.  
  184. class Csharp : public ProgLanguage
  185. {
  186.     int CreationDate; //2001
  187. public:
  188.     Csharp()
  189.     {
  190.         this->CreationDate;
  191.     }
  192.     Csharp(int CreationDate)
  193.     {
  194.         this->CreationDate = CreationDate;
  195.     }
  196.     int getCreationDate(int CreationDate)
  197.     {
  198.         return CreationDate;
  199.     }
  200.     void setCreationDate(int CreationDate)
  201.     {
  202.         this->CreationDate = CreationDate;
  203.     }
  204.     void printCreationDate()
  205.     {
  206.         cout << "Creation date is " << CreationDate << endl;
  207.     }
  208. };
  209.  
  210. int main()
  211. {
  212.     int k = 0;
  213.     cout << "Select programming language\n1 - C\n2 - C++\n3 - both\n4 - C#";
  214.     cin >> k;
  215.     switch (k)
  216.     {
  217.     case 1:
  218.     {
  219.         C C;
  220.         C.setName("C");
  221.         C.setLowLevel(true);
  222.         C.setMultiparadigm(true);
  223.         C.setCompiled(true);
  224.         C.setStaticallyTyped(true);
  225.         C.setObjectOriented(false);
  226.         C.setCreationDate(1969);
  227.         C.printName();
  228.         C.printCreationDate();
  229.         C.printLowLevel();
  230.         C.printMultiparadigm();
  231.         C.printCompiled();
  232.         C.printStaticallyTyped();
  233.         C.printObjectOriented();
  234.         break;
  235.     }
  236.     case 2:
  237.     {
  238.         Cpp Cpp;
  239.         Cpp.setName("C++");
  240.         Cpp.setLowLevel(false);
  241.         Cpp.setMultiparadigm(true);
  242.         Cpp.setCompiled(true);
  243.         Cpp.setStaticallyTyped(true);
  244.         Cpp.setObjectOriented(true);
  245.         Cpp.setCreationDate(1985);
  246.         Cpp.printName();
  247.         Cpp.printCreationDate();
  248.         Cpp.printLowLevel();
  249.         Cpp.printMultiparadigm();
  250.         Cpp.printCompiled();
  251.         Cpp.printStaticallyTyped();
  252.         Cpp.printObjectOriented();
  253.         break;
  254.     }
  255.     case 3:
  256.     {
  257.         C C;
  258.         C.setName("C");
  259.         C.setLowLevel(true);
  260.         C.setMultiparadigm(true);
  261.         C.setCompiled(true);
  262.         C.setStaticallyTyped(true);
  263.         C.setObjectOriented(false);
  264.         C.setCreationDate(1969);
  265.         C.printName();
  266.         C.printCreationDate();
  267.         C.printLowLevel();
  268.         C.printMultiparadigm();
  269.         C.printCompiled();
  270.         C.printStaticallyTyped();
  271.         C.printObjectOriented();
  272.         cout << "\n---------------------------------------------------------------------------------------\n";
  273.         Cpp Cpp;
  274.         Cpp.setName("C++");
  275.         Cpp.setLowLevel(false);
  276.         Cpp.setMultiparadigm(true);
  277.         Cpp.setCompiled(true);
  278.         Cpp.setStaticallyTyped(true);
  279.         Cpp.setObjectOriented(true);
  280.         Cpp.setCreationDate(1985);
  281.         Cpp.printName();
  282.         Cpp.printCreationDate();
  283.         Cpp.printLowLevel();
  284.         Cpp.printMultiparadigm();
  285.         Cpp.printCompiled();
  286.         Cpp.printStaticallyTyped();
  287.         Cpp.printObjectOriented();
  288.         cout << "\n---------------------------------------------------------------------------------------\n";
  289.         Csharp Csharp;
  290.         Csharp.setName("C#");
  291.         Csharp.setLowLevel(false);
  292.         Csharp.setMultiparadigm(true);
  293.         Csharp.setCompiled(false);
  294.         Csharp.setStaticallyTyped(true);
  295.         Csharp.setObjectOriented(true);
  296.         Csharp.setCreationDate(2001);
  297.         Csharp.printName();
  298.         Csharp.printCreationDate();
  299.         Csharp.printLowLevel();
  300.         Csharp.printMultiparadigm();
  301.         Csharp.printCompiled();
  302.         Csharp.printStaticallyTyped();
  303.         Csharp.printObjectOriented();
  304.         break;
  305.     }
  306.     case 4:
  307.     {
  308.         Csharp Csharp;
  309.         Csharp.setName("C#");
  310.         Csharp.setLowLevel(false);
  311.         Csharp.setMultiparadigm(true);
  312.         Csharp.setCompiled(false);
  313.         Csharp.setStaticallyTyped(true);
  314.         Csharp.setObjectOriented(true);
  315.         Csharp.setCreationDate(2001);
  316.         Csharp.printName();
  317.         Csharp.printCreationDate();
  318.         Csharp.printLowLevel();
  319.         Csharp.printMultiparadigm();
  320.         Csharp.printCompiled();
  321.         Csharp.printStaticallyTyped();
  322.         Csharp.printObjectOriented();
  323.         break;
  324.     }
  325.     }
  326.     system("pause");
  327. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement