Witam, napisałem kod ale napotkałem kilka błędów i nie wiem jak sobie poradzić.
Kod:
#include <iostream>
using namespace std;
struct BOOK
{
char title[10];
char author[5];
unsigned index;
float price;
};
BOOK list [100];
void Cheap_book( BOOK list[])
{ int counter;
bool occurs = false;
cout<<"list of cheap book"<<endl;
for (int i = 0; i < counter; i++)
{
if( list[i].price < 10.00)
{
cout << "title:" << list[i].title<<endl;
cout << "author:" << list[i].author<<endl;
cout << "index:" << list[i].index<<endl;
cout << "price:" << list[i].price<<endl;
occurs = true;
}
if (!occurs)
{
cout<<"the list is empty"<<endl;
cout<<"press enter"<<endl;
cin.get();
}
}
}
int main(){
BOOK book1[100];
book1[1].title="rein";
book1[1].author="piter";
book1.index=1;
book1.price=9;
void Cheap_book();
}
Błędy
[Error] incompatible types in assignment of 'const char [5]' to 'char [10]'
[Error] incompatible types in assignment of 'const char [6]' to 'char [5]'
[Error] request for member 'index' in 'book1', which is of non-class type 'BOOK [100]'
[Error] request for member 'price' in 'book1', which is of non-class type 'BOOK [100]'