Код ссылается не в необходимый класс, как исправить?

В коде, насколько я понял, ошибка такова, что он ссылается на первый написанный класс по умолчанию, соответственно функции из других классов, на которые я ссылаюсь, он там не находит и выдает ошибку. Если вдруг я не прав, вот список ошибок.
In function 'int main()':
[Error] conflicting declaration 'Reader symbol [500]'
[Note] previous declaration as 'Bibl symbol [500]'
[Error] conflicting declaration 'Order symbol [500]'
[Note] previous declaration as 'Bibl symbol [500]'
[Error] 'class Bibl' has no member named 'Add_Reader'
[Error] 'class Bibl' has no member named 'Add_Order'
[Error] 'class Bibl' has no member named 'GetReader'
[Error] 'class Bibl' has no member named 'GetOrder'


Вот сам код
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;

class Bibl {
private: 
	string Bibl_name, PIB, adres, otdel; int nomer; 
public:
	void Add_Bibl(string a, string b, string c, int d, string e) {
		Bibl_name = a;
		PIB = b;
		adres = c;
		nomer = d;
		otdel = e;
	}
	void GetBibl() {
		cout << "Librarian name: \t" << Bibl_name << endl << "Full name: \t" << PIB << endl << "Address: \t" << adres << endl << "Phone number: \t" << nomer << endl << "The Department: " << otdel << endl;
		} 
	} ;

class Reader {
private:
	string Bibl_name_r, PIB_r; int nomer_r, zakaz;
public:
	void Add_Reader(string f, string g, int h, int j) {
		Bibl_name_r = f;
		PIB_r = g;
		nomer_r = h;
		zakaz = j;
	}
	void GetReader() {
		cout << "Librarian name: \t" << Bibl_name_r << endl << "Full name: \t" << PIB_r << endl << "Phone number: \t" << nomer_r << endl << "Order number: \t" << zakaz << endl;
	}
} ;

class Order {
private:
	string book, autor, time1, time2; int year;
public:
	void Add_Order(string k, string l, string m, string n, int o) {
		book = k;
		autor = l;
		time1 = m;
		time2 = n;
		year = o;
	}
	void GetOrder() {
		cout << "Book name: \t" << book << endl << "Autor name: \t" << autor << endl << "Year of issue: \t" << year << endl << "Delivery time to the client: \t" << time1 << endl << "Hold time" << time2 << endl;
	}
} ;


int main() {
	string a, b, c, e; int d;
	string f, g; int h, j;
	string k, l, m, n; int o;
	bool soft = true;
	short menu, Bibl_kol, Reader_kol, Order_kol;
	Bibl symbol[500];
	Reader symbol[500];
	Order symbol[500];
while (soft == true) {
	system ("cls");
	cout << "\t 1) Dobavit bibliotekar" << endl << "\t 2) Dobavit chitatel" << endl << "\t 3) Dobavit zakaz" << endl << "\t 4) Spisok bibl" << endl << "\t 5) Spisok reader" << endl << "\t 6) Spisok zakazov" << endl;
	cin >> menu;

	if (menu == 1) {
		system ("cls");
		cout << ("Skolko bibliotekar dobavit? "); cin >> Bibl_kol;
		for (int i = 0; i < Bibl_kol; i++) {
				system ("cls");

				cout << "Librarian name: "; cin >> a, cout << endl;
				cout << "Full name: "; cin >> b; cout << endl;
				cout << "Address: "; cin >> c; cout << endl;
				cout << "Phone number: "; cin >> d; cout << endl;
				cout << "The Department: "; cin >> e; cout << endl;
				symbol[i].Add_Bibl(a, b, c, d, e);
			}
			cout << "Dobavleno." << endl;
			Sleep (3000);
	}
	if (menu == 2) {
		system ("cls");
		cout << ("Skolko reader dobavit? "); cin >> Reader_kol;
		for (int i = 0; i < Reader_kol; i++) {
				system ("cls");

				cout << "Librarian name: "; cin >> f, cout << endl;
				cout << "Full name: "; cin >> g; cout << endl;
				cout << "Phone number: "; cin >> h; cout << endl;
				cout << "Order name: "; cin >> j; cout << endl;
				symbol[i].Add_Reader(f, g, h, j);
			}
			cout << "Dobavleno." << endl;
			Sleep (3000);
	}
	if (menu == 3) {
		system ("cls");
		cout << ("Skolko zakazov dobavit? "); cin >> Order_kol;
		for (int i = 0; i < Order_kol; i++) {
				system ("cls");

				cout << "Book name: "; cin >> k, cout << endl;
				cout << "Autor name: "; cin >> l; cout << endl;
				cout << "Year of issue: "; cin >> o; cout << endl;
				cout << "Delivery time to the client: "; cin >> m; cout << endl;
				cout << "Hold time: "; cin >> n, cout << endl;
				symbol[i].Add_Order(k, l, o, m, n);
			}
			cout << "Dobavleno." << endl;
			Sleep (3000);
	}
	if (menu == 4) { 
         	system ("cls");
         	for (int i = 0; i < Bibl_kol; i++) {
         		symbol[i].GetBibl();
         		Sleep(1000);
         	}
         	Sleep (3000);
         }
    if (menu == 5) { 
         	system ("cls");
         	for (int i = 0; i < Reader_kol; i++) {
         		symbol[i].GetReader();
         		Sleep(1000);
         	}
         	Sleep (3000);
         }
    if (menu == 6) { 
         	system ("cls");
         	for (int i = 0; i < Order_kol; i++) {
         		symbol[i].GetOrder();
         		Sleep(1000);
         	}
         	Sleep (3000);
         }
    }
return 0; 
}
  • Вопрос задан
  • 70 просмотров
Решения вопроса 1
Переменные
Bibl symbol[500];
  Reader symbol[500];
  Order symbol[500];
надо назвать по-разному.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы