Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 4
- Савельев Самсон Алексеевич,0,1,0,1,0,0
- Константинов Василий Владимирович 0,1,0,0
- Соколова Марина Михайловна,0,1
- Покровский Наум Юрьевич,
- #define _CRT_SECURE_NO_WARNINGS
- #include iostream
- #include cstdio
- #include string
- using namespace std;
- class KURSA4
- {
- private:
- struct worker
- {
- int worked_together;
- int psy_compatible;
- };
- int n;
- worker** ptr;
- string* name;
- public:
- void print_matrix() //отладочная функция, не забудь удалить,
- {
- for (int i = 0; i < n; i++)
- {
- cout << name[i];
- }
- for (int i = 0; i < n; i++)
- for (int j = 0; j < n; j++)
- {
- cout << ptr[i][j].worked_together;
- }
- }
- KURSA4()
- {
- FILE* file = fopen("H:/KURS/list.txt", "rt");
- fscanf(file, "%d", &n);
- ptr = new worker*[n];
- name = new string[n];
- for (int i = 0; i < n; i++)
- {
- ptr[i] = new worker[n];
- }
- for (int i = 0; i < n; i++)
- {
- char temp[50];
- fscanf(file, "%[^,]", temp);
- name[i] = (const char*)temp;
- for (int j = i + 1; j < n ; j++)
- {
- worker temp;
- fscanf(file, "%d,%d", &temp.worked_together, &temp.psy_compatible);
- ptr[i][j].worked_together = temp.worked_together;
- ptr[j][i].worked_together = temp.worked_together;
- ptr[i][j].psy_compatible = temp.psy_compatible;
- ptr[j][i].psy_compatible = temp.psy_compatible;
- }
- }
- }
- };
- void main()
- {
- setlocale(LC_ALL, "RUS");
- KURSA4 a2;
- a2.print_matrix();
- system("PAUSE");
- }
- Савельев Самсон Алексеевич
- Савельев Самсон Алексеевич
- Савельев Самсон Алексеевич
- Савельев Самсон Алексеевич-842150451-858993460-858993460-858993460-858993460-842
- 150451-858993460-858993460-858993460-858993460-842150451-858993460-858993460-858
- 993460-858993460-842150451Для продолжения нажмите любую клавишу . . .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement