Здравствуйте, помогите пожалуйста нарисовать блок-схему к программе.
Код:
// Lab1 (2).cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <conio.h>
#include <string.h>
using namespace std;
//Структура динамического однонаправленного списка
struct node{
string name;
int rate;
node *next;
};
class journal{
private:
node *head;
public:
journal(){
head = NULL;
}
//Добавление записи в журнал
void add(string name, int rate){
node *_new = new node;
_new->name = name;
_new->rate = rate;
_new->next = head;
head = _new;
}
//Добавление массива записей в журнал
void add(int n,string names[], int rates[])
{
for (int i = 0; i < n; i++)add(names[i], rates[i]);
}
//Вывод
void show(){
cout <<"------------------------------------------"<<endl;
node *cur = head;
while (cur != NULL){
cout << "Имя: " << cur->name << " Оценка: " << cur->rate << endl;
cur = cur->next;
}
cout <<"------------------------------------------"<<endl;
}
//Поиск двоечников. возвращает список фамилий, параметр К - количество
vector<string> count_2(int *k){
vector<string>names;
node *cur = head;
while (cur != NULL){
if (cur->rate == 2)names.push_back(cur->name);
cur = cur->next;
}
*k = names.size();
return names;
}
//Удаляет двоечника с фамилией - name
void del(string name){
if (head == NULL)cout << "Список пуст";
else{
if (head->name == name)head = head->next;
else{
node *cur = head;
node *prev=NULL;
while (cur!= NULL){
if (cur->name == name){
prev->next = cur->next;
}
prev = cur;
cur = cur->next;
}
}
}
}
//Удаляет двоечников с фамилиями взятыми из списка names
void del(vector<string>names){
for (int i = 0; i < names.size(); i++)del(names[i]);
}
};
int main(){
setlocale(LC_ALL, "Russian");
cout << "Введите количество Журналов" << endl;
int n;
cin >> n;
char ch;
//Работа класса
journal *j=new journal[n];
for (int i = 0; i < n; i++){
cout << "Заполнение " << i + 1 << "-го журнала:" << endl;
do{
cout << "\n Фамилия:";
string s;
cin >> s;
cout << "\n Оценка:";
int rate;
cin >> rate;
j[i].add(s, rate);
cout << "\n Закончить? y/n " << endl;;
ch = _getch();
} while (ch != 'y');
}
vector<string>names;
int count,max = 0;
for (int i = 0; i < n; i++){
cout << "Журнал("<<i<<"):" << endl;
j[i].show();
int k = 0;
j[i].count_2(&k);
if (max <= k){
names = j[i].count_2(&k);
max = k;
count = i;
}
}
cout<<"Удаление студента по фамилии:"<<endl;
do{
cout<<"Введите фамилию студента для удаления (журнал с максимальным кол-вом двоечников):"<<endl;
string fam;
cin>>fam;
j[count].del(fam);
cout << "Журнал после удаления:" << endl;
j[count].show();
cout << "\n Закончить? y/n " << endl;;
ch = _getch();
} while (ch != 'y');
cout <<endl<< "Журнал с наибольшим количеством двоечников" << endl;
j[count].show();
system("PAUSE");
return 0;
}