Кабінет 208
Головна | Реєстрація | Вхід
Вівторок, 22.01.2019, 23:02
Меню сайту
Форма входу

Категорії розділу
5 клас [11]
6 клас [5]
7 клас [3]
8 клас [15]
9 клас [19]
10 клас (стардарт) [5]
10 клас (академічний) [0]
11 клас (стандарт) [21]
11 клас (академічний) [23]
Головна » Статті » Інформатика » 11 клас (академічний)

Класи в С++ (друга)

// ver 2.cpp: определяет точку входа для консольного приложения.
//

#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
    cout << "????" << endl;
    cout << "Version 2\n" << endl;
    cout << "start modeling\n" << endl;
    {
        Project pr;
        Project pr1("", "", 1, 1);
        Project pr2(pr);
    }
    cout << "\nfinish modeling\n\n" << endl;
    system("pause");
    return 0;
}


 * Module:  Project.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;

Project::Project():
m_company(1),
m_university(1),
m_ministry(),
name(""),
description(""),
term_of_execution(1),
number_of_worker(1)
{
    cout << "Project was created (default)" << endl;
}

Project::Project(string n, string d, int t, int numb)
:m_company(0,Company("",1,"","")),
m_university(1, University("", 1, 1, 1)),
m_ministry("",1,1),
name(n),
description(d),
term_of_execution(t),
number_of_worker(numb)
{
    cout << "Project was created (initialization)" << endl;
}

Project::Project(const Project& sProject)
:m_company(sProject.m_company),
m_university(sProject.m_university),
m_ministry(sProject.m_ministry),
name(sProject.name),
description(sProject.description),
term_of_execution(sProject.term_of_execution),
number_of_worker(sProject.number_of_worker)
{
    cout << "Project was created (copy)" << endl;
}

Project::Project(std::string str)
:m_company(0, Company("AA__11__AA__AA")),
m_university(1, University("AA__11__11__11")),
m_ministry("AA__11__11")
{

    std::string str1 = str.substr(0, 4);
    name = str1;

    std::string str2 = str.substr(4, 4);
    description = str2;

    std::string str3 = str.substr(8, 4);
    const char* s3 = str3.c_str();
    term_of_execution = atoi(s3);

    std::string str4 = str.substr(12, 4);
    const char* s4 = str4.c_str();
    number_of_worker = atoi(s4);

    cout << "Project was created (transformation)." << endl;
} // конструктор перетворення


Project::~Project()
{
    cout << "Project was deleted" << endl;
}

void Project::start(void)
{
   // TODO : implement
}

 * Module:  Project.h
#if !defined(__ClassDiagram_Project_h)
#define __ClassDiagram_Project_h

#include "stdafx.h"
#include "Company.h"
#include "University.h"
#include "Ministry.h"
#include<string>
#include<iostream>
#include <vector>
using namespace std;

class Company;
class University;
class Ministry;

 

class Project
{
protected:
private:
    std::vector <Company> m_company;
    std::vector <University> m_university;
    Ministry m_ministry;
    
   std::string name;
   std::string description;
   int term_of_execution;
   int number_of_worker;
 
public:
    Project();
    Project(string, string, int, int);
    Project(const Project&);
    Project(string);
    ~Project();

   void start(void);

  /* Company** company;
   University** university;
   Ministry* ministry;
   */
};

#endif

 * Module:  Company.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include "conio.h"
#include <vector>
#include<string>
#include<iostream>
using namespace std;

Company::Company() :
m_employee(1),
name(""),
number_of_employees(1),
location(""),
type_of_employment("")
{
    cout << "Company was created (default)" << endl;
}

Company::Company(string n, int numb, string l, string t)
:
m_employee(0,Employee("dd",1,"ff",1)),
name(n),
number_of_employees(numb),
location(l),
type_of_employment(t)
{
    cout << "Company was created (initialization)" << endl;
}

Company::Company(const Company& sCompany)
:m_employee(sCompany.m_employee),
name(sCompany.name),
number_of_employees(sCompany.number_of_employees),
location(sCompany.location),
type_of_employment(sCompany.type_of_employment)
{
    cout << "Company was created (copy)" << endl;
}

Company::Company(std::string str) :
m_employee(0, Employee("dd"))
{

    std::string str1 = str.substr(0, 4);
    name = str1;

    std::string str2 = str.substr(4, 4);
    const char* s2 = str2.c_str();
    number_of_employees = atoi(s2);

    std::string str3 = str.substr(8, 4);
    location = str3;

    std::string str4 = str.substr(12, 4);
    type_of_employment = str4;

    cout << "Company was created (transformation)." << endl;
} // конструктор перетворення

Company::~Company()
{
    cout << "Company was deleted" << endl;
}


void Company::produce_products(void)
{
   // TODO : implement
}

void Company::create_your_own_divisions(void)
{
   // TODO : implement
}

void Company::fund_university(void)
{
   // TODO : implement
}

void Company::give_projects(void)
{
   // TODO : implement
}

 * Module:  Company.h
#if !defined(__ClassDiagram_Company_h)
#define __ClassDiagram_Company_h
#include "stdafx.h"
#include "Employee.h"
#include<string>
#include<iostream>
#include<vector>
using namespace std;

class Employee;

class Company
{
protected:
private:
    std::vector <Employee> m_employee;

   std::string name;
   int number_of_employees;
   std::string location;
   std::string type_of_employment;
   
public:
    Company();
    Company(string, int, string, string);
    Company(const Company&);
    Company(string);
    ~Company();

   void produce_products(void);
   void create_your_own_divisions(void);
   void fund_university(void);
   void give_projects(void);

   Employee** employee;

};

#endif

 * Module:  Employee.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;

Employee::Employee()
:name(""),
age(0),
work(""),
salary(0)
{
    cout << "Employee was created (default)" << endl;
}

Employee::Employee(string n, int a, string w, int s)
:name(n),
age(a),
work(w),
salary(s)
{
    cout << "Employee was created (initialization)" << endl;
}

Employee::Employee(const Employee& sEmployee)
:name(sEmployee.name),
age(sEmployee.age),
work(sEmployee.work),
salary(sEmployee.salary)
{
    cout << "Employee was created (copy)" << endl;
}

Employee::Employee(std::string str){

    std::string str1 = str.substr(0, 4);
    name = str1;

    std::string str2 = str.substr(4, 4);
    const char* s2 = str2.c_str();
    age = atoi(s2);

    std::string str3 = str.substr(8, 4);
    work = str3;

    std::string str4 = str.substr(12, 4);
    const char* s4 = str4.c_str();
    salary = atoi(s4);

    cout << "Employee was created (transformation)." << endl;
} // конструктор перетворення

Employee::~Employee()
{
    cout << "Employee was deleted" << endl;
}


void Employee::give_project(void)
{
   // TODO : implement
}

void Employee::provide_resources(void)
{
   // TODO : implement
}

void Employee::keeps_track_implementation(void)
{
   // TODO : implement
}

void Employee::takes_job(void)
{
   // TODO : implement
}

 * Module:  Employee.h
#if !defined(__ClassDiagram_Employee_h)
#define __ClassDiagram_Employee_h
#include "stdafx.h"
#include<string>
#include<iostream>
using namespace std;

class Employee
{
protected:
private:
   std::string name;
   int age;
   std::string work;
   int salary;


public:
    Employee();
    Employee(string, int, string, int);
    Employee(const Employee&);
    Employee(string);
    ~Employee();

   void give_project(void);
   void provide_resources(void);
   void keeps_track_implementation(void);
   void takes_job(void);

};

#endif

 * Module:  Ministry.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;

Ministry::Ministry()
:name(""),
number_of_employee(0),
budget(0)
{
    cout << "Ministry was created (default)" << endl;
}

Ministry::Ministry(string n, int numb, int b)
:name(n),
number_of_employee(numb),
budget(b)
{
    cout << "Ministry was created (initialization)" << endl;
}

Ministry::Ministry(const Ministry& sMinistry)
:name(sMinistry.name),
number_of_employee(sMinistry.number_of_employee),
budget(sMinistry.budget)
{
    cout << "Ministry was created (copy)" << endl;
}

Ministry::Ministry(std::string str){

    std::string str1 = str.substr(0, 4);
    name = str1;

    std::string str2 = str.substr(4, 4);
    const char* s2 = str2.c_str();
    number_of_employee = atoi(s2);

    std::string str3 = str.substr(8, 4);
    const char* s3 = str3.c_str();
    budget = atoi(s3);

    cout << "Ministry was created (transformation)." << endl;
} // конструктор перетворення

Ministry::~Ministry()
{
    cout << "Ministry was deleted" << endl;
}

void Ministry::set_framework_for_university(void)
{
   // TODO : implement
}

void Ministry::provide_staff(void)
{
   // TODO : implement
}

void Ministry::provide_necessary_resources(void)
{
   // TODO : implement
}

 * Module:  Ministry.h
#if !defined(__ClassDiagram_Ministry_h)
#define __ClassDiagram_Ministry_h
#include "stdafx.h"
#include<string>
#include<iostream>
using namespace std;
class Ministry
{
protected:
private:
   int number_of_employee;
   int budget;
   std::string name;

public:
    Ministry();
    Ministry(string, int, int);
    Ministry(const Ministry&);
    Ministry(string);
    ~Ministry();

   void set_framework_for_university(void);
   void provide_staff(void);
   void provide_necessary_resources(void);


};

#endif

 * Module:  Professor.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;

Professor::Professor():
name(""),
age(1),
work(""),
experience(1),
faculty("")
{
    cout << "Professor was created (default)" << endl;
}// конструктор за замовченням

Professor::Professor(string n, int a, string w, int e, string f):
name(n),
age(a),
work(w),
experience(e),
faculty(f)
{
    cout << "Professor was created (initialization)" << endl;
}// конструктор ініціалізації

Professor::Professor(const Professor& sProfessor):
name(sProfessor.name),
age(sProfessor.age),
work(sProfessor.work),
experience(sProfessor.experience),
faculty(sProfessor.faculty)
{
    cout << "Professor was created (copy)" << endl;
}// конструктор копії

Professor::Professor(std::string str){

    std::string str1 = str.substr(0, 4);
    name = str1;

    std::string str2 = str.substr(4, 4);
    const char* s2 = str2.c_str();
    age = atoi(s2);
    
    std::string str3 = str.substr(8, 4);
    work = str3;

    std::string str4 = str.substr(12, 4);
    const char* s4 = str4.c_str();
    experience = atoi(s4);

    std::string str5 = str.substr(16, 4);
    faculty = str5;

    cout << "Professor was created (transformation)." << endl;
} // конструктор перетворення

Professor::~Professor()
{
    cout << "Professor was deleted" << endl;
}

void Professor::teach_student(void)
{
   // TODO : implement
}

void Professor::work_on_the_project(void)
{
   // TODO : implement
}

void Professor::conduct_research(void)
{
   // TODO : implement
}

 * Module:  Professor.h
#if !defined(__ClassDiagram_Professor_h)
#define __ClassDiagram_Professor_h
#include "stdafx.h"
#include "Professor.h"
#include<string>
#include<iostream>
using namespace std;

class Professor
{
protected:
private:
   std::string name;
   int age;
   std::string work;
   int experience;
   std::string faculty;

public:
    Professor();
    Professor(string, int, string, int, string);
    Professor(const Professor&);
    Professor(string);
    ~Professor();

   void teach_student(void);
   void work_on_the_project(void);
   void conduct_research(void);

};

#endif

 * Module:  Student.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;

Student::Student()
:name(""),
age(0),
group(""),
course(0),
faculty("")
{
    cout << "Student was created (default)" << endl;
}

Student::Student(string n, int a, string g, int c, string f)
:name(n),
age(a),
group(g),
course(c),
faculty(f)
{
    cout << "Student was created (initialization)" << endl;
}

Student::Student(const Student& sStudent)
:name(sStudent.name),
age(sStudent.age),
group(sStudent.group),
course(sStudent.course),
faculty(sStudent.faculty)
{
    cout << "Student was created (copy)" << endl;
}

Student::Student(std::string str){

    std::string str1 = str.substr(0, 4);
    name = str1;

    std::string str2 = str.substr(4, 4);
    const char* s2 = str2.c_str();
    age = atoi(s2);

    std::string str3 = str.substr(8, 4);
    group = str3;

    std::string str4 = str.substr(12, 4);
    const char* s4 = str4.c_str();
    course = atoi(s4);

    std::string str5 = str.substr(16, 4);
    faculty = str5;

    cout << "Student was created (transformation)." << endl;
} // конструктор перетворення


Student::~Student()
{
    cout << "Student was deleted" << endl;
}

void Student::study_at_univer(void)
{
   // TODO : implement
}

void Student::working_on_a_project(void)
{
   // TODO : implement
}

void Student::conducts_research(void)
{
   // TODO : implement
}

 * Module:  Student.h
#if !defined(__ClassDiagram_Student_h)
#define __ClassDiagram_Student_h

#include "stdafx.h"
#include<string>
#include<iostream>
using namespace std;

class Student
{
protected:
private:
   std::string name;
   int age;
   std::string faculty;
   int course;
   std::string group;

public:
    Student();
    Student(string, int, string, int, string);
    Student(const Student&);
    Student(string);
    ~Student();

   void study_at_univer(void);
   void working_on_a_project(void);
   void conducts_research(void);
};

#endif

 * Module:  University.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;

University::University()
:m_student(1),
m_professor(1),
name(""),
number_of_students(1),
number_of_teachers(1),
number_of_faculties(1)
{
    cout << "University was created (default)" << endl;
}

University::University(string n, int ns, int nt, int nf)
:m_student(0,Student("ss",1,"",1,"")),
m_professor(1, Professor("ss", 1, "", 1, "")),
name(n),
number_of_students(ns),
number_of_teachers(nt),
number_of_faculties(nf)
{
    cout << "University was created (initialization)" << endl;
}

University::University(const University& sUniversity)
:m_student(sUniversity.m_student),
m_professor(sUniversity.m_professor),
name(sUniversity.name),
number_of_students(sUniversity.number_of_students),
number_of_teachers(sUniversity.number_of_teachers),
number_of_faculties(sUniversity.number_of_faculties)
{
    cout << "University was created (copy)" << endl;
}

University::University(std::string str)
:m_student(0,Student("AA__11__11__11")),
m_professor(1, Professor("AA__11__11__11"))
{

    std::string str1 = str.substr(0, 4);
    name = str1;

    std::string str2 = str.substr(4, 4);
    const char* s2 = str2.c_str();
    number_of_students = atoi(s2);

    std::string str3 = str.substr(8, 4);
    const char* s3 = str3.c_str();
    number_of_teachers = atoi(s3);

    std::string str4 = str.substr(12, 4);
    const char* s4 = str4.c_str();
    number_of_faculties = atoi(s4);

    cout << "University was created (transformation)." << endl;
} // конструктор перетворення

University::~University()
{
    cout << "University was deleted" << endl;
}


void University::implement_projects(void)
{
   // TODO : implement
}

void University::create_special_departments(void)
{
   // TODO : implement
}

void University::create_conditions_for_project_implementation(void)
{
   // TODO : implement
}

void University::generate_new_technology(void)
{
   // TODO : implement
}

 * Module:  University.h
#if !defined(__ClassDiagram_University_h)
#define __ClassDiagram_University_h

#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include<string>
#include<iostream>
#include<vector>
using namespace std;

class Student;
class Professor;

class University
{
protected:
private:

    std::vector <Student> m_student;
    std::vector <Professor> m_professor;

    std::string name;
   int number_of_students;
   int number_of_teachers;
   int number_of_faculties;

public:
    University();
    University(string, int, int,int);
    University(const University&);
    University(string);
    ~University();

   void implement_projects(void);
   void create_special_departments(void);
   void create_conditions_for_project_implementation(void);
   void generate_new_technology(void);

  /* Student** student;
   Professor** professor;
   */
};

#endif

Категорія: 11 клас (академічний) | Додав: admin (04.01.2016)
Переглядів: 10
Пошук
Статистика

Онлайн всього: 1
Гостей: 1
Користувачів: 0
Copyright MyCorp © 2019
Безкоштовний хостинг uCoz