ФІО = GVA Запитання:#include #include #include #include #include #include #define DBFN "base.db" // imya bazi danih #define MAXSTR 80 // MAXIMALNA DOVJUNA SRTOKI struct TDataType{ // tup zapusyemuh danyh char nazva[MAXSTR]; int obsag; char data[MAXSTR]; double vartist; }; long FileGetCount(){ // metod rahue kilkist elementiv v baza danyh FILE *file = fopen(DBFN,"rb"); fseek (file , 0 , SEEK_END); long Size = ftell (file) / sizeof(TDataType); // rewind (file); fclose(file); return Size; } long EnterN(long max=0) { // programa prosut vvesty 4uslo NUMBER = [0;MAX] if (max == -1) return -1; long a; cout<>a; } while (a<0 && a>max); return a; } TDataType FileShowByIndex(long index) { // povertae strukturu danuh pid miscem index v basi danuh (napramy) long count = FileGetCount(); TDataType temp,temp0; FILE *file = fopen(DBFN,"rb"); rewind(file); long i = 0; fseek(file, sizeof(TDataType)*index, 0); // for (i = 0 ; i < count ; i++) { fread(&temp,sizeof(TDataType),1,file); // if ( index == i ) temp0=temp; } fclose(file); return temp0; } void FileEditByIndex(long index,TDataType a) { // zapusye struktury v BD v index pozuciy TDataType temp; FILE *file = fopen(DBFN,"r+b"); rewind(file); fseek(file, sizeof(TDataType)*index, 0); fwrite(&a,sizeof(TDataType),1,file); fclose(file); return ; } void ShowInfoDlg(TDataType &a) { // VUVODUT stdukturu v zrozymilomy formati dla korustuvacha clrscr(); cout<<"\n"; cout<<" NAZVA : "<>a.nazva; cout<<" Enter OBSAG [ INT ] : "; cin>>a.obsag; cout<<" Enter DATA [ STR ] : "; cin>>a.data; cout<<" Enter VART [ DBL ] : "; cin>>a.vartist; return ConfirmYN(" Applay changes"); } int main() { int key; do { clrscr(); cout<<" PROGRAM MAIN MENU:\n\n 1 ) Add new record\n 2 ) Edit record in database\n 3 ) Show record by indnex\n 4 ) Show all records \n 0 ) Destroy database\n\n ESC) exit \n\n"; cout<<" RECORD(S) : "<