Cześć, piszę program na zadanie domowe. Mam problem z funkcją 'void takeb(vector <Book> library)". Chciałbym zrobić taką procedure która po podaniu numery ksiązki z 'bazy ksiazek' zmienia zmienną 'able' na 'false'. Co powinienem wpisać w 'cin' i jak powinna wyglądać deklaracja 'bool' bo wyskakują mi błędy. WELP
#include <iostream>
#include <vector>
#include <windows.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
struct Book
{
string title;
string author;
int isbn;
int nr;
int amount;
bool able;
};
vector <Book> library;
void display(vector<Book> library)
{
for (int i = 0; i < library.size() ; i++)
{
cout << " nr: " << library[i].nr << endl;
cout << " title: " << library[i].title << endl;
cout << " author: " << library[i].author << endl;
cout << " nr ISBN: " << library[i].isbn << endl;
cout << " ilosc: " << library[i].amount << endl;
if(library[i].able = true)
cout << " pozycja dostepna" << endl;
else
cout << " pozycja niedostepna" << endl;
}
cout << "\n" << endl;
}
void takeb(vector<Book> library)
{
cout << " wypozyczanie ksiazek " << endl;
cout << " wprowadz nr ksiazki z bazy " << endl;
}
int wybor;
int main()
{
vector <Book> library;
for(;;)
{
cout << " WITAJ W BIBLIOTECE " << endl;
cout << "--------------------" << endl;
cout << "----MENU GŁOWNE-----" << endl;
cout << " 1. DODAJ KSIAZKE DO BAZY " << endl;
cout << " 2. WYSWIETL WSZYSTKIE" << endl;
cout << " 3. WYSWIETL DOSTEPNE" << endl;
cout << " 4. ZWROC KSIAZKE" << endl;
cout << " 5. WYPOZYCZ" << endl;
cout << " 6. WYJDZ" << endl;
cout << " WYBIERZ: "; cin >> wybor;
switch(wybor)
{
case 1 :
{
Book b;
b.title;
b.author;
b.isbn;
b.amount;
b.nr ++;
system("cls");
cout << "---DODAJ KSIAZKE DO BAZY---" << endl;
cout << " 1. PODAJ TYTUL: ";
cin >> b.title;
cout << " 2. PODAJ AUTOR: ";
cin >> b.author;
cout << " 3. PODAJ ISBN: ";
cin >> b.isbn;
cout << " 4. PODAJ ILOSC: ";
cin >> b.amount;
b.able = true;
library.push_back(b);
}
break;
case 2 :
{
system("cls");
cout << "---WSZYSTKIE KSIAZKI W BAZIE---" << endl;
cout << endl;
display(library);
getchar();
}
break;
case 3 :
{
}
}
}
return 0;
}
if(!(!(!library[i].able)))
;D