Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class ProgLanguage
- {
- string Name; // название языка
- bool LowLevel; // является ли низкоуровневым
- bool Multiparadigm; // является ли мультипарадигмальным (можно писать программы в рамках нескольких парадигм программирования)
- bool Compiled; // является ли язык компилируемым
- bool StaticallyTyped; // является ли язык статически типизированным (Каждая сущность в программе (переменная, функция и пр.) имеет свой тип, и этот тип определяется на момент компиляции)
- bool ObjectOriented; // является ли язык объектно-ориентированным
- public:
- ProgLanguage()
- {
- this->Name = "";
- this->LowLevel = false;
- this->Multiparadigm = false;
- this->Compiled = false;
- this->StaticallyTyped = false;
- this->ObjectOriented = false;
- }
- string getName()
- {
- return Name;
- }
- bool getLowLevel()
- {
- return LowLevel;
- }
- bool getMultiparadigm()
- {
- return Multiparadigm;
- }
- bool getCompiled()
- {
- return Compiled;
- }
- bool getStaticallyTyped()
- {
- return StaticallyTyped;
- }
- bool getObjectOriented()
- {
- return ObjectOriented;
- }
- void setName(string Name)
- {
- this->Name = Name;
- }
- void setLowLevel(bool LowLevel)
- {
- this->LowLevel = LowLevel;
- }
- void setMultiparadigm(bool Multiparadigm)
- {
- this->Multiparadigm = Multiparadigm;
- }
- void setCompiled(bool Compield)
- {
- this->Compiled = Compield;
- }
- void setStaticallyTyped(bool StaticallyTyped)
- {
- this->StaticallyTyped = StaticallyTyped;
- }
- void setObjectOriented(bool ObjectOriented)
- {
- this->ObjectOriented = ObjectOriented;
- }
- void printName()
- {
- cout << "Language name: " << Name << endl;
- }
- void printLowLevel()
- {
- if (LowLevel)
- {
- cout << "Is a low-level language" << endl;
- }
- else
- {
- cout << "Is not a low-level language" << endl;
- }
- }
- void printMultiparadigm()
- {
- if (Multiparadigm)
- {
- cout << "Language is multiparadigm" << endl;
- }
- else
- {
- cout << "Language is not multiparadigm" << endl;
- }
- }
- void printCompiled()
- {
- if (Compiled)
- {
- cout << "Language is compiled" << endl;
- }
- else
- {
- cout << "Language is not compiled" << endl;
- }
- }
- void printStaticallyTyped()
- {
- if (StaticallyTyped)
- {
- cout << "Language is statically typed" << endl;
- }
- else
- {
- cout << "Language is not compiled" << endl;
- }
- }
- void printObjectOriented()
- {
- if (ObjectOriented)
- {
- cout << "Language is objectoriented" << endl;
- }
- else
- {
- cout << "Language is not object oriented " << endl;
- }
- }
- };
- class C : public ProgLanguage
- {
- int CreationDate; // 1969
- public:
- C()
- {
- this->CreationDate = 0;
- }
- C(int CreationDate)
- {
- this->CreationDate = CreationDate;
- }
- int getCreationDate(int CreationDate)
- {
- return CreationDate;
- }
- void setCreationDate(int CreationDate)
- {
- this->CreationDate = CreationDate;
- }
- void printCreationDate()
- {
- cout << "Creation date is " << CreationDate << endl;
- }
- };
- class Cpp : public ProgLanguage
- {
- int CreationDate; //1985
- public:
- Cpp()
- {
- this->CreationDate;
- }
- Cpp(int CreationDate)
- {
- this->CreationDate = CreationDate;
- }
- int getCreationDate(int CreationDate)
- {
- return CreationDate;
- }
- void setCreationDate(int CreationDate)
- {
- this->CreationDate = CreationDate;
- }
- void printCreationDate()
- {
- cout << "Creation date is " << CreationDate << endl;
- }
- };
- class Csharp : public ProgLanguage
- {
- int CreationDate; //2001
- public:
- Csharp()
- {
- this->CreationDate;
- }
- Csharp(int CreationDate)
- {
- this->CreationDate = CreationDate;
- }
- int getCreationDate(int CreationDate)
- {
- return CreationDate;
- }
- void setCreationDate(int CreationDate)
- {
- this->CreationDate = CreationDate;
- }
- void printCreationDate()
- {
- cout << "Creation date is " << CreationDate << endl;
- }
- };
- int main()
- {
- int k = 0;
- cout << "Select programming language\n1 - C\n2 - C++\n3 - both\n4 - C#";
- cin >> k;
- switch (k)
- {
- case 1:
- {
- C C;
- C.setName("C");
- C.setLowLevel(true);
- C.setMultiparadigm(true);
- C.setCompiled(true);
- C.setStaticallyTyped(true);
- C.setObjectOriented(false);
- C.setCreationDate(1969);
- C.printName();
- C.printCreationDate();
- C.printLowLevel();
- C.printMultiparadigm();
- C.printCompiled();
- C.printStaticallyTyped();
- C.printObjectOriented();
- break;
- }
- case 2:
- {
- Cpp Cpp;
- Cpp.setName("C++");
- Cpp.setLowLevel(false);
- Cpp.setMultiparadigm(true);
- Cpp.setCompiled(true);
- Cpp.setStaticallyTyped(true);
- Cpp.setObjectOriented(true);
- Cpp.setCreationDate(1985);
- Cpp.printName();
- Cpp.printCreationDate();
- Cpp.printLowLevel();
- Cpp.printMultiparadigm();
- Cpp.printCompiled();
- Cpp.printStaticallyTyped();
- Cpp.printObjectOriented();
- break;
- }
- case 3:
- {
- C C;
- C.setName("C");
- C.setLowLevel(true);
- C.setMultiparadigm(true);
- C.setCompiled(true);
- C.setStaticallyTyped(true);
- C.setObjectOriented(false);
- C.setCreationDate(1969);
- C.printName();
- C.printCreationDate();
- C.printLowLevel();
- C.printMultiparadigm();
- C.printCompiled();
- C.printStaticallyTyped();
- C.printObjectOriented();
- cout << "\n---------------------------------------------------------------------------------------\n";
- Cpp Cpp;
- Cpp.setName("C++");
- Cpp.setLowLevel(false);
- Cpp.setMultiparadigm(true);
- Cpp.setCompiled(true);
- Cpp.setStaticallyTyped(true);
- Cpp.setObjectOriented(true);
- Cpp.setCreationDate(1985);
- Cpp.printName();
- Cpp.printCreationDate();
- Cpp.printLowLevel();
- Cpp.printMultiparadigm();
- Cpp.printCompiled();
- Cpp.printStaticallyTyped();
- Cpp.printObjectOriented();
- cout << "\n---------------------------------------------------------------------------------------\n";
- Csharp Csharp;
- Csharp.setName("C#");
- Csharp.setLowLevel(false);
- Csharp.setMultiparadigm(true);
- Csharp.setCompiled(false);
- Csharp.setStaticallyTyped(true);
- Csharp.setObjectOriented(true);
- Csharp.setCreationDate(2001);
- Csharp.printName();
- Csharp.printCreationDate();
- Csharp.printLowLevel();
- Csharp.printMultiparadigm();
- Csharp.printCompiled();
- Csharp.printStaticallyTyped();
- Csharp.printObjectOriented();
- break;
- }
- case 4:
- {
- Csharp Csharp;
- Csharp.setName("C#");
- Csharp.setLowLevel(false);
- Csharp.setMultiparadigm(true);
- Csharp.setCompiled(false);
- Csharp.setStaticallyTyped(true);
- Csharp.setObjectOriented(true);
- Csharp.setCreationDate(2001);
- Csharp.printName();
- Csharp.printCreationDate();
- Csharp.printLowLevel();
- Csharp.printMultiparadigm();
- Csharp.printCompiled();
- Csharp.printStaticallyTyped();
- Csharp.printObjectOriented();
- break;
- }
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement