0 / 0 / 0
Регистрация: 22.06.2016
Сообщений: 8
1

Переделать код под ООП

25.06.2016, 02:34. Показов 592. Ответов 0

Author24 — интернет-сервис помощи студентам
Помогите пожалуйста. Необходимо переделать данный код под ООП. Очень срочно, люди добрые. Помогите, буду век благодарен
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "stdafx.h"
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/istreamwrapper.h"
#include <iostream>
#include "rapidjson/prettywriter.h"
#include <string>
#include <fstream>
using namespace rapidjson;
using namespace std;
 
int main() {
 
    std::ifstream ifs("test-json-file.json");
    IStreamWrapper isw(ifs);
    Document documentFromFile;
    documentFromFile.ParseStream(isw);
 
 
std:string slovo;
    std::cout << "Vvedite name" << std::endl;
    std::cin >> slovo;
    struct mystruct{
        char b[20];
        char c[20];
        char d[20];
        char e[20];
        char f[20];
        char g[20];
        char k[30];
    };
    mystruct str1[20];
    mystruct str2[20];
    mystruct str3[20];
    mystruct str4[20];
    mystruct str5[20];
    mystruct str6[20];
    mystruct str7[20];
    //с учетом одного предка
    strcpy_s(str1[0].b, "/courses/teacher");
    strcpy_s(str2[0].e, "/courses/subject");
    strcpy_s(str5[0].f, "/students/name1");
    strcpy_s(str6[0].g, "/students/name2");
    strcpy_s(str7[0].k, "/abiturient/name3");
    if (str1[0].b == slovo)
    {
        std::cout << "/courses/"<< "teacher/" <<("%s\n", documentFromFile["courses"]["teacher"].GetString()) << std::endl;
    }
    else if (str4[0].e == slovo)
    {
        std::cout << "/courses/" <<"subject/" <<("%s\n", documentFromFile["courses"]["subject"].GetString()) << std::endl;
    }
    else if (str5[0].f == slovo)
    {
        std::cout << "/students/" <<"name1/" << ("%s\n", documentFromFile["courses"]["students"]["name1"].GetString()) << std::endl;
    }
    else if (str6[0].g == slovo)
    {
        std::cout << "/students/" << "name2/" << ("%s\n", documentFromFile["courses"]["students"]["name2"].GetString()) << std::endl;
    }
    else if (str7[0].k == slovo)
    {
        std::cout << "/abiturient/" << "name3/" << ("%s\n", documentFromFile["courses"]["students"]["abiturient"]["name3"].GetString()) << std::endl;
    }
Содержимое файла test-json-file.json
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
 "namse": "univer",
 "address": "Bluher",
 "b": [1,2,3,4],
 "courses": 
       {
           "subject": "mathematic", 
           "teacher": "John Malkovich",
           "students": 
                    {
                     "name1":"Bobby",
                     "name2":"Sam",
                     "abiturient":
                     {
                     "name3":"Kirill"
                     }     
      }
      }
}
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
25.06.2016, 02:34
Ответы с готовыми решениями:

Переделать код в ООП
Помогите переделать код в ООП #include &quot;stdafx.h&quot; #include &lt;stdlib.h&gt; #include&lt;iostream&gt;...

Переделать код под c++
Есть код Pascal, нужно его переделать под c++. Но поскольку в этом не особо разбираюсь прошу у вас...

Переделать код под стандарт C++98
с++ переделать код под стандарт с++98 #include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;tuple&gt;...

Переделать код под указатели
Помогите пожалуйста переделать под указатели int main() { int i,dlina1=0; char txt; cout...

0
25.06.2016, 02:34
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
25.06.2016, 02:34
Помогаю со студенческими работами здесь

Переделать код под динамический массив
Необходимо переделать данный код, под динамический массив используя функции malloc и free #include...

Переделать код под другое условие
Всем привет,и заранее спасибо Программа работает следующим образом: в листе list.h объявляются...

Переделать код под Visual studio, С++
Как переделать код под visual studio 2013 или хотя бы сказать работает ли она на visual studio...

Переделать код под считывание из файла
Проблема такова сделать конвертер дюймов в мм ,но чтобы все считывалось из текстового файла...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru