Выдает ошибку
#include <math.h>;
#include <fstream>;
#include <iostream>;
#include <string>;
using namespace std;
struct BookCathalog {
string author;
string name;
string date;
string publishing;
string size;
string genre;
};
int globalSize = 0;
int CinNewCathalog(struct BookCathalog* cath) {
int BookSize;
cout << "Количество новых позиций > ";
cin >> BookSize;
for (int i = 0; i < BookSize; i++) {
cout << "Автор: ";
cin >> cath[i].author;
cout << "Название: ";
cin >> cath[i].name;
cout << "Дата: ";
cin >> cath[i].date;
cout << "Издательство: ";
cin >> cath[i].publishing;
cout << "Жанр: ";
cin >> cath[i].genre;
cout << "Кол-во стр:";
cin >> cath[i].size;
cout << " ---" << endl;
}
::globalSize = BookSize;
return BookSize;
}
void FillCathalog(struct BookCathalog* cath) {
cath[0].author = "Ричард Лаймон";
cath[0].name = "Луна - парк";
cath[0].date = "1989 год";
cath[0].publishing = "Funland";
cath[0].genre = "ужасы";
cath[0].size = "638 стр";
cath[1].author = "Брэм Стокер";
cath[1].name = "Дракула";
cath[1].date = "1897 год ";
cath[1].publishing = "Archibald Constable and Company";
cath[1].genre = "ужасы";
cath[1].size = "448 стр";
cath[2].author = "Роджер Желязны";
cath[2].name = "Князь Света";
cath[2].date = "1967 год";
cath[2].publishing = "Doubleday";
cath[2].genre = "фантастика";
cath[2].size = "530 стр";
cath[3].author = "Герберт Уэллс";
cath[3].name = "Война миров";
cath[3].date = "1987 год";
cath[3].publishing = "Heinemann";
cath[3].genre = "фантастика";
cath[3].size = "480 стр";
cath[4].author = "Виктор Астафьев";
cath[4].name = "Прокляты и убиты";
cath[4].date = "1992 год";
cath[4].publishing = "UK";
cath[4].genre = "военный";
cath[4].size = "541 стр";
::globalSize = 4;
cout << "GlobalSize = " << ::globalSize << endl;
}
void CoutCathalog(struct BookCathalog* cath, int genre) {
for (int i = 0; i < genre; i++) {
cout << "-" << endl;
cout << "Автор: " << cath[i].author << endl;
cout << "Название: " << cath[i].name << endl;
cout << "Дата: " << cath[i].date << endl;
cout << "Издательство: " << cath[i].publishing << endl;
cout << "Жанр: " << cath[i].genre << endl;
cout << "Кол-во стр: " << cath[i].size << endl;
}
}
void SearchInCathalog(struct BookCathalog* cath, int genre) {
setlocale(LC_ALL,"Russian");
bool found = false;
int genreF;
string author;
cout << "Жанр:\n ";
cin >> genreF;
cout << "Автор:\n ";
cin >> author;
for (int i = 0; i < genre; i++) {
if (genreF == cath[i].genre && author == cath[i].author) {
cout << "Автор: " << cath[i].author << endl;
cout << "Название: " << cath[i].name << endl;
cout << "Дата: " << cath[i].date << endl;
cout << "Издательство: " << cath[i].publishing << endl;
cout << "Жанр: " << cath[i].genre << endl;
cout << "Кол-во стр: " << cath[i].size << endl;
found = true;
}
}
if (found) {
cout << "\n Ничего не найдено :/" << endl;
}
}
int main() {
setlocale(LC_ALL, "Russian");
int cathSize;
int v, v2;
cout << "1.Создать новый\n2.Заполнить по стандарту\n";
cin >> v;
cout << "\n" << endl;
BookCathalog* buildingSuppliesList = new BookCathalog[10];
switch (v) {
case 1:
cathSize = CinNewCathalog(buildingSuppliesList);
CoutCathalog(buildingSuppliesList, cathSize);
break;
case 2:
FillCathalog(buildingSuppliesList);
CoutCathalog(buildingSuppliesList, 5);
break;
default:
break;
}
cout << "\n\n1.Поиск\n2.Выход\n";
cin >> v2;
switch (v2) {
case 1:
SearchInCathalog(buildingSuppliesList, ::globalSize);
break;
default:
break;
}
}