#include<iostream> #include<windows.h> // для system("cls"); using namespace std; struct librariesCatalog { char author[64]; char name[64]; int date; char group[64]; }; void showData(const librariesCatalog Obj[], int amount); int main() { setlocale(LC_ALL, "rus"); const int amountOfBooks = 1; librariesCatalog Book[amountOfBooks] = {};//на эту часть реагирует С++ Builder for (int i = 0; i < amountOfBooks; i++) { cout << "Books author: "; cin.getline(Book[i].author, 32); cout << "Name: "; cin.getline(Book[i].name, 32); cout << "Year of publication: "; cin >> Book[i].date; cin.ignore(); cout << "Group: (f - Fiction, e - educational literature , r - further reading)"; cin.getline(Book[i].group, 32); cout << endl; } showData(Book, amountOfBooks); return 0; } void showData(const librariesCatalog Obj[], int amount) { system("cls"); cout << "№\t" << "Books author\t" << "Name\t" << "\tYear of publication\t" << "\tGroup\t" << endl; cout << "=============================================================================" << endl; for (int i = 0; i < amount; i++) { cout << i + 1 << '\t' << Obj[i].author << '\t'<< Obj[i].name<< '\t'<< '\t' << Obj[i].date << '\t' << '\t' <<'\t' << Obj[i].group << endl; } } 

Error text:

[C ++ Error] Unit1.cpp (24): E2264 Expression expected

Closed due to the fact that it was off topic by Nicolas Chabanovsky Jan 26 '17 at 7:57 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Nicolas Chabanovsky
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Write librariesCatalog Book [amountOfBooks] = {{'\ 0'}}; - Vlad from Moscow
  • Check out what a minimal reproducible example is so that in the future you don’t need to bring in a lot of unnecessary code in the question. - αλεχολυτ
  • five
    @performance Did you find my comment angry? By no means. I just want the question to be useful not only for you, but also for others who can come here from Google. When the text is a lot of "water" to grasp the essence is more difficult. The ability to create a minimal reproducible example is worth a lot and this must be learned. - αλεχολυτ

1 answer 1

It looks like C ++ Builder does not allow initialization with empty curly braces.

So try initializing the array as follows.

 librariesCatalog Book[amountOfBooks] = { { '\0' } };