Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
0 / 0 / 0
Регистрация: 18.09.2012
Сообщений: 4

С++ и обработка данных типа структура

07.01.2011, 11:30. Показов 1383. Ответов 0
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Здравствуйте! Такая проблема: есть программа, которая управляет базой данных "Кинотеатр". При попытке ее компилирования и запуска вылетает ошибка ([Build Error] [Безымянный1.o] Error 1 ).
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<iomanip.h>
#include <dos.h>
#include <io.h>
 
const int L=30;
struct building
{
char name[L];
    char F[L];
    int S;
    char A[L];
    int K;
    int d;
};
const int N=100;
class buildings
{
private:
    building a[N];
    int n;
 
public:
void input_file();
void outputfile();
void alfsort();
void sohranenie();
void sort_chisl_2();
void sort_chisl_1();
void sort_chisl_3();
void sort_chisl_4();
void add();
void udalenie();
void redaktirovanie();
void input();
void poisk();
 
 
 
};
void main()
{
buildings a;
int pm;
while(1)
{cout<<endl;
cout<<"   1. Vvod faila "<<endl;
cout<<"   2. Vivod iz faila "<<endl;
cout<<"   3. Alfovitna`a sortirovka "<<endl;
cout<<"   4. Zapis dannih v file "<<endl;
cout<<"   5. Sortirovka po nazvaniu filma "<<endl;
cout<<"   6. Sortirovka po stoimosti "<<endl;
cout<<"   7. Sortirovka po adresu "<<endl;
cout<<"   8. Sortirovka po kol-vu mest "<<endl;
cout<<"   9. Dobavlenie zapisi v bazu dannih "<<endl;
cout<<"   10. Udalenie zapisi iz bazi dannih "<<endl;
cout<<"   11. Redaktirovanie "<<endl;
cout<<"   12. Sozdanie novoi bazi dannih "<<endl;
cout<<"   13. Konec raboti "<<endl;
cout<<endl<<endl;
cout<<"   Vash vibor 1-13: ";
cin>>pm;
cout<<endl<<endl;
switch(pm)
{
case 1:a.input_file();break;
case 2:a.outputfile();getch();break;
case 3:a.alfsort();break;
case 4:a.sohranenie();break;
case 5:a.sort_chisl_1();break;
case 6:a.sort_chisl_2();break;
case 7:a.sort_chisl_3();break;
case 8:a.sort_chisl_4();break;
case 9:a.add();break;
case 10:a.udalenie();break;
case 11:a.redaktirovanie();break;
case 12:a.input();break;
case 13:cout<<"Konec raboti";
    getch();
        return;
    default:cout<<"Net tacogo puncta.";
        getch();break;
     }
 }
 
}
 
//Vvod file 1//
    void buildings::alfsort()
{
  int fl,i,l;
   building t;
  l=n-1;
  do
  {
   
      fl=0;
   
      for(i=0;i<l;i++)
    
          if(strcmp(a[i].name ,a[i+1].name )>0)
          {
      
              t=a[i];
      
              a[i]=a[i+1];
      
              a[i+1]=t;
      
              fl=1;
    
    
          }
    
          
    
                          l--;
  
  }
 
 
 
  while(fl==1);
  return;
 
}
 
//Vivod iz file 2//
void buildings::input_file() 
    {
 
 
 
        ifstream fin;
 
        char file[L];
 
        cout<<"Ukazite put k failu: ";
 
        cin>>file;
 
        fin.open(file);
 
        if(fin==NULL)
 
        {
     
            cout<<"File not open";
     
            getch();
     
            exit(1);
 
        }
 
        n=0;
 
 
        fin>>a[n].name>>a[n].F>>a[n].S>>a[n].A>>a[n].K;
 
        while(fin.good())
 
        {
     
            n++;
     
     
            fin>>a[n].name>>a[n].F>>a[n].S>>a[n].A>>a[n].K;
 
        }
 
        fin.close();
 
 
    }
 
//Alfovitna`a sortirovka 3//
 
void buildings::outputfile() 
 
    {
  
        int i;
  
        cout<<setw(15)<<"Naimenovanie "<<setw(12)<<"Nazvanie filma "<<setw(15)<<"Stoimost biletov "<<setw(11)<<"Adres "<<setw(16)<<"Kol-vo mest "<<endl;
  cout<<endl;
        for(i=0;i<n;i++)
  
            cout<<setw(10)<<a[i].name<<setw(15)<<a[i].F<<setw(11)<<a[i].S<<setw(23)<<a[i].A<<setw(10)<<a[i].K<<endl;
    
    }
 
//Zapis dannih v file 4//
    void buildings::sort_chisl_1()
{
  int fl,i,l;
   building t;
  l=n-1;
  do
  {
   
      fl=0;
   
      for(i=0;i<l;i++)
    
          if(strcmp(a[i].F ,a[i+1].F )>0)
          {
      
              t=a[i];
      
              a[i]=a[i+1];
      
              a[i+1]=t;
      
              fl=1;
    
    
          }
    
          
    
                          l--;
  
  }
 
 
 
  while(fl==1);
  return;
 
}
 
 
//Sortirovka po nazvaniu filma 5//
void buildings::sort_chisl_2()
{
   int fl,i,l;
    building t;
   
  l=n-1;
  do
  {
   fl=0;
   for(i=0;i<l;i++)
    if(a[i].S>a[i+1].S)
    {
      t=a[i];
      a[i]=a[i+1];
      a[i+1]=t;
      fl=1;
    }
 
   l--;
 
  }
  while(fl==1);
  return;
 
}
    
//Sortirovka po stoimosti 6//
 
    void buildings::sort_chisl_3()
{
  int fl,i,l;
   building t;
  l=n-1;
  do
  {
   
      fl=0;
   
      for(i=0;i<l;i++)
    
          if(strcmp(a[i].A ,a[i+1].A )>0)
          {
      
              t=a[i];
      
              a[i]=a[i+1];
      
              a[i+1]=t;
      
              fl=1;
    
    
          }
    
          
    
                          l--;
  
  }
 
 
 
  while(fl==1);
  return;
 
}
 
//Sortirovka po adresu 7//  
    void buildings::sort_chisl_4()
{
   int fl,i,l;
   building t;
  l=n-1;
  do
  {
   fl=0;
   for(i=0;i<l;i++)
    if(a[i].K>a[i+1].K)
    {
      t=a[i];
      a[i]=a[i+1];
      a[i+1]=t;
      fl=1;
    }
 
   l--;
 
  }
  while(fl==1);
  return;
 
}
    
//Sortirovka po kol-vu mest 8//
    void buildings::sohranenie()
{
    char file[L];
    ofstream out;
    int otvet;
 
    cout<<"Sohranit izmeneniya?"<<endl<<"Yes(press 1),No(press 0)";
   
 
    cin>>otvet;
   
 
    if(otvet==1)
   
    {
     
        cout<<"Vvedite direktoriyu, kuda vj bj hoteli sohranit: ";
     
        cin>>file;
     
        out.open(file);
     
        if(out==NULL)
     
        {
       
            cout<<"File ne sozdan"<<endl<<"Programm to be finished";
       
            getch();
       
            exit(1);
     
        }
    }
    
  int i;
  for(i=0;i<n;i++)
    out<<setw(10)<<a[i].name<<setw(10)<<a[i].F<<setw(10)<<a[i].S<<setw(13)<<a[i].A<<setw(13)<<a[i].K<<endl;
 
 cout<<endl;
 
}
    
//Dobavlenie zapisi v bazu dannih 9 //
void buildings::redaktirovanie()
{
int c,r;
cout<<"Vvedite nomer stroki,kotoruiu nujno otredaktirovat: ";
cin>>c;
cout<<c<<"."<<a[c-1].name<<" "<<a[c-1].F<<" "<<a[c-1].S<<" "<<a[c-1].A<<" "<<a[c-1].K<<endl;
    
 
cout<<"Izmenit naimenovanie? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"Naimeninavanie: ";
    cin>>a[c-1].name;
}
cout<<"Izmenit nazvanie filma? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"Nazvanie filma: ";
    cin>>a[c-1].F;
}
cout<<"Izmenit stoimost? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"stoimost";
    cin>>a[c-1].S;
}
cout<<"Izmenit adres? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"adres: ";
    cin>>a[c-1].A;
}
cout<<"Izmenit kol-vo mest? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"kol-vo mest:";
    cin>>a[c-1].K;
}
cout<<endl;
 
cout<<"Redaktirovanie zaversheno."<<endl;
return;
}
 
//Udalenie zapisi iz bazi dannih 10//
void buildings::udalenie()
{
 
    int i,c;
 
    cout<<"Vvedite nomer stroki,kotoruiu neobhodimo udalit: "<<endl;
 
    cin>>c;
 
    if (c>n) cout<<"Dannaia stroka v baze dannih otsutstvuet."<<endl;
 
    else
 
    {
 
        cout<<c<<"."<<a[c-1].name<<" "<<a[c-1].F<<" "<<a[c-1].S<<" "<<a[c-1].A<<" "<<a[c-1].K<<endl;
 
        for (i=c;i<=n;i++)
 
        {
 
            a[i-1] = a[i];
        }
 
        cout<<"Stroka "<<c<<" udalena."<<endl;
 
        n=n-1;
    }
 
    return;
 
}
//Redaktirovanie 11//
void buildings::add()
{
 
    struct building x;
 
    cout<<"Vvedite dannie novogo Kinoteatra: "<<endl;
 
    cout<<n+1<<".";
 
    cout<<"Nomer: "<<endl;
    
    cin>>x.d;
 
    cout<<"Naimenovanie: ";
 
    cin>>x.name;
 
    cout<<"Nazvanie filma: ";
 
    cin>>x.F;
 
    cout<<"Stoimost bileta: ";
 
    cin>>x.S;
 
    cout<<"Adres: ";
 
    cin>>x.A;
 
    cout<<"Kol-vo mest: ";
 
    cin>>x.K;
 
 
    cout<<endl;
 
    a[n]=x;
 
    n=n+1;
 
    cout<<"Zapisi dobavleni."<<endl;
 
    return;
 
}
 
//Sozdanie novoi bazi dannih 12//
void buildings::input()
{
int i;
cout<<"Vvedite kolichestvo strok:"<<endl;
cin>>n;
cout<<"Vvedite dannie Kinoteatra:"<<endl;
for (i=0;i<n;i++)
{
cout<<i+1<<".";
cout<<"Nomer: "<<endl;
cin>>a[i].d;
cout<<"Naimenovanie: ";
cin>>a[i].name;
cout<<"Nazvanie filma: ";
cin>>a[i].F;
cout<<"Stoimost bileta: ";
cin>>a[i].S;
cout<<"Adres: ";
cin>>a[i].A;
cout<<"Kol-vo mest: ";
cin>>a[i].K;
cout<<endl;
}
cout<<"Dannie vvedeni."<<endl<<endl;
}
 
 
void buildings::poisk()
{
    int i,d=0,f=0,j=0;
    int q,w,e,r,t;
    
    char name[L];
    int S,K;
    char F[L], A[L];
    
 
    cout<<"Proizvesti poisk po: "<<endl;
    cout<<"Naimenovaniyu? Da-1,Net-0: ";
    cin>>q;
    if(q==1) {cout<<"Vvedite Naimenovanie:"; cin>>name;f++;}
    cout<<"Iskat po nazvaniyu filma? Da-1,Net-0: ";
    cin>>w;
    if(w==1) {cout<<"Vvedite nazvanie filma: ";cin>>F;f++;}
    cout<<"iskat po stoimosti bileta?Da-1,Net-0: ";
    cin>>e;
    if(e==1) {cout<<"Vvedite stoimost bileta: "; cin>>S;f++;}
    cout<<"Iskat po adresu? Da-1,Net-0: ";
    cin>>r;
    if(r==1) {cout<<"Vvedite adres: ";cin>>A;f++;}
    cout<<"Iskat po kol-vu mest? Da-1,Net-0: ";
    cin>>t;
    if(t==1) {cout<<"Vvedite kol-vo mest: ";cin>>K;f++;}
    
    for(i=0;i<n;i++)
    {
        if(q==1) {if(strcmp(name, a[i].name)==0) d=d+1;}
        if(w==1) {if(strcmp(F, a[i].F)==0) d=d+1;}
        if(e==1) {if(S==a[i].S) d=d+1;}
        if(r==1) {if(strcmp(A, a[i].A)==0) d=d+1;}
        if(t==1) {if(K==a[i].K) d=d+1;}
        
       if(d==f) {cout<<endl<<setw(5)<<i+1<<setw(12)<<a[i].name<<setw(11)<<a[i].F<<setw(14)<<a[i].S<<setw(10)<<a[i].A<<setw(15)<<a[i].K<<endl; j=j+1;}
       d=0;
    }
    if(j==0) cout<<"Poisk ne dal rezultata!"<<endl<<endl;
    cout<<endl<<endl;
}
Пробовал компилировать в Dev-C++ POrtable.
Помогите разобраться, пожалуйста! Заранее спасибо

Добавлено через 1 час 2 минуты
Подправил код немного, были несколько пунктов неправильно, но вопрос остался прежним.
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<iomanip.h>
#include <dos.h>
#include <io.h>
 
const int L=30;
struct building
{
char name[L];
    char F[L];
    int S;
    char A[L];
    int K;
    int d;
};
const int N=100;
class buildings
{
private:
    building a[N];
    int n;
 
public:
void input_file();
void outputfile();
void alfsort();
void sohranenie();
void sort_chisl_2();
void sort_chisl_1();
void sort_chisl_3();
void sort_chisl_4();
void add();
void udalenie();
void redaktirovanie();
void input();
void poisk();
 
 
 
};
void main()
{
buildings a;
int pm;
while(1)
{cout<<endl;
cout<<"   1. Vvod faila "<<endl;
cout<<"   2. Vivod iz faila "<<endl;
cout<<"   3. Alfovitna`a sortirovka "<<endl;
cout<<"   4. Zapis dannih v file "<<endl;
cout<<"   5. Sortirovka po nazvaniu filma "<<endl;
cout<<"   6. Sortirovka po stoimosti "<<endl;
cout<<"   7. Sortirovka po adresu "<<endl;
cout<<"   8. Sortirovka po kol-vu mest "<<endl;
cout<<"   9. Dobavlenie zapisi v bazu dannih "<<endl;
cout<<"   10. Udalenie zapisi iz bazi dannih "<<endl;
cout<<"   11. Redaktirovanie "<<endl;
cout<<"   12. Sozdanie novoi bazi dannih "<<endl;
cout<<"   13. Konec raboti "<<endl;
cout<<endl<<endl;
cout<<"   Vash vibor 1-13: ";
cin>>pm;
cout<<endl<<endl;
switch(pm)
{
case 1:a.input_file();break;
case 2:a.outputfile();getch();break;
case 3:a.alfsort();break;
case 4:a.sohranenie();break;
case 5:a.sort_chisl_1();break;
case 6:a.sort_chisl_2();break;
case 7:a.sort_chisl_3();break;
case 8:a.sort_chisl_4();break;
case 9:a.add();break;
case 10:a.udalenie();break;
case 11:a.redaktirovanie();break;
case 12:a.input();break;
case 13:cout<<"Konec raboti";
    getch();
        return;
    default:cout<<"Net tacogo puncta.";
        getch();break;
     }
 }
 
}
 
 
//Vivod iz file 1//
void buildings::input_file() 
    {
 
 
 
        ifstream fin;
 
        char file[L];
 
        cout<<"Ukazite put k failu: ";
 
        cin>>file;
 
        fin.open(file);
 
        if(fin==NULL)
 
        {
     
            cout<<"File not open";
     
            getch();
     
            exit(1);
 
        }
 
        n=0;
 
 
        fin>>a[n].name>>a[n].F>>a[n].S>>a[n].A>>a[n].K;
 
        while(fin.good())
 
        {
     
            n++;
     
     
            fin>>a[n].name>>a[n].F>>a[n].S>>a[n].A>>a[n].K;
 
        }
 
        fin.close();
 
 
    }
 
//Alfovitna`a sortirovka 2//
 
void buildings::outputfile() 
 
    {
  
        int i;
  
        cout<<setw(15)<<"Naimenovanie "<<setw(12)<<"Nazvanie filma "<<setw(15)<<"Stoimost biletov "<<setw(11)<<"Adres "<<setw(16)<<"Kol-vo mest "<<endl;
  cout<<endl;
        for(i=0;i<n;i++)
  
            cout<<setw(10)<<a[i].name<<setw(15)<<a[i].F<<setw(11)<<a[i].S<<setw(23)<<a[i].A<<setw(10)<<a[i].K<<endl;
    
    }
//Vvod file 3//
    void buildings::alfsort()
{
  int fl,i,l;
   building t;
  l=n-1;
  do
  {
   
      fl=0;
   
      for(i=0;i<l;i++)
    
          if(strcmp(a[i].name ,a[i+1].name )>0)
          {
      
              t=a[i];
      
              a[i]=a[i+1];
      
              a[i+1]=t;
      
              fl=1;
    
    
          }
    
          
    
                          l--;
  
  }
 
 
 
  while(fl==1);
  return;
 
}
 
//Vvod file 3//
    void buildings::alfsort()
{
  int fl,i,l;
   building t;
  l=n-1;
  do
  {
   
      fl=0;
   
      for(i=0;i<l;i++)
    
          if(strcmp(a[i].name ,a[i+1].name )>0)
          {
      
              t=a[i];
      
              a[i]=a[i+1];
      
              a[i+1]=t;
      
              fl=1;
    
    
          }
    
          
    
                          l--;
  
  }
 
 
 
  while(fl==1);
  return;
 
}
 
//Sohranenie izmeneni`4//
    void buildings::sohranenie()
{
    char file[L];
    ofstream out;
    int otvet;
 
    cout<<"Sohranit izmeneniya?"<<endl<<"Yes(press 1),No(press 0)";
   
 
    cin>>otvet;
   
 
    if(otvet==1)
   
    {
     
        cout<<"Vvedite direktoriyu, kuda vj bj hoteli sohranit: ";
     
        cin>>file;
     
        out.open(file);
     
        if(out==NULL)
     
        {
       
            cout<<"File ne sozdan"<<endl<<"Programm to be finished";
       
            getch();
       
            exit(1);
     
        }
    }
    
  int i;
  for(i=0;i<n;i++)
    out<<setw(10)<<a[i].name<<setw(10)<<a[i].F<<setw(10)<<a[i].S<<setw(13)<<a[i].A<<setw(13)<<a[i].K<<endl;
 
 cout<<endl;
 
}
 
//Sortirovka po nazvaniu filma 5//
    void buildings::sort_chisl_1()
{
  int fl,i,l;
   building t;
  l=n-1;
  do
  {
   
      fl=0;
   
      for(i=0;i<l;i++)
    
          if(strcmp(a[i].F ,a[i+1].F )>0)
          {
      
              t=a[i];
      
              a[i]=a[i+1];
      
              a[i+1]=t;
      
              fl=1;
    
    
          }
    
          
    
                          l--;
  
  }
 
 
 
  while(fl==1);
  return;
 
}
 
 
//Sortirovka po stoimosti 6//
void buildings::sort_chisl_2()
{
   int fl,i,l;
    building t;
   
  l=n-1;
  do
  {
   fl=0;
   for(i=0;i<l;i++)
    if(a[i].S>a[i+1].S)
    {
      t=a[i];
      a[i]=a[i+1];
      a[i+1]=t;
      fl=1;
    }
 
   l--;
 
  }
  while(fl==1);
  return;
 
}
    
//Sortirovka po adresu 7//
 
    void buildings::sort_chisl_3()
{
  int fl,i,l;
   building t;
  l=n-1;
  do
  {
   
      fl=0;
   
      for(i=0;i<l;i++)
    
          if(strcmp(a[i].A ,a[i+1].A )>0)
          {
      
              t=a[i];
      
              a[i]=a[i+1];
      
              a[i+1]=t;
      
              fl=1;
    
    
          }
    
          
    
                          l--;
  
  }
 
 
 
  while(fl==1);
  return;
 
}
 
//Sortirovka po kol-vu mest 8// 
    void buildings::sort_chisl_4()
{
   int fl,i,l;
   building t;
  l=n-1;
  do
  {
   fl=0;
   for(i=0;i<l;i++)
    if(a[i].K>a[i+1].K)
    {
      t=a[i];
      a[i]=a[i+1];
      a[i+1]=t;
      fl=1;
    }
 
   l--;
 
  }
  while(fl==1);
  return;
 
}
    
//Dobavlenie novo` zapisi 9//
void buildings::add()
{
 
    struct building x;
 
    cout<<"Vvedite dannie novogo Kinoteatra: "<<endl;
 
    cout<<n+1<<".";
 
    cout<<"Nomer: "<<endl;
    
    cin>>x.d;
 
    cout<<"Naimenovanie: ";
 
    cin>>x.name;
 
    cout<<"Nazvanie filma: ";
 
    cin>>x.F;
 
    cout<<"Stoimost bileta: ";
 
    cin>>x.S;
 
    cout<<"Adres: ";
 
    cin>>x.A;
 
    cout<<"Kol-vo mest: ";
 
    cin>>x.K;
 
 
    cout<<endl;
 
    a[n]=x;
 
    n=n+1;
 
    cout<<"Zapisi dobavleni."<<endl;
 
    return;
 
}
    
 
//Udalenie zapisi iz bazi dannih 10//
void buildings::udalenie()
{
 
    int i,c;
 
    cout<<"Vvedite nomer stroki,kotoruiu neobhodimo udalit: "<<endl;
 
    cin>>c;
 
    if (c>n) cout<<"Dannaia stroka v baze dannih otsutstvuet."<<endl;
 
    else
 
    {
 
        cout<<c<<"."<<a[c-1].name<<" "<<a[c-1].F<<" "<<a[c-1].S<<" "<<a[c-1].A<<" "<<a[c-1].K<<endl;
 
        for (i=c;i<=n;i++)
 
        {
 
            a[i-1] = a[i];
        }
 
        cout<<"Stroka "<<c<<" udalena."<<endl;
 
        n=n-1;
    }
 
    return;
 
}
 
//Redaktirovanie zapisi 11 //
void buildings::redaktirovanie()
{
int c,r;
cout<<"Vvedite nomer stroki,kotoruiu nujno otredaktirovat: ";
cin>>c;
cout<<c<<"."<<a[c-1].name<<" "<<a[c-1].F<<" "<<a[c-1].S<<" "<<a[c-1].A<<" "<<a[c-1].K<<endl;
    
 
cout<<"Izmenit naimenovanie? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"Naimeninavanie: ";
    cin>>a[c-1].name;
}
cout<<"Izmenit nazvanie filma? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"Nazvanie filma: ";
    cin>>a[c-1].F;
}
cout<<"Izmenit stoimost? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"stoimost";
    cin>>a[c-1].S;
}
cout<<"Izmenit adres? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"adres: ";
    cin>>a[c-1].A;
}
cout<<"Izmenit kol-vo mest? (1 Da/0 Net):"<<endl;
cin>>r;
if(r)
{
    cout<<"kol-vo mest:";
    cin>>a[c-1].K;
}
cout<<endl;
 
cout<<"Redaktirovanie zaversheno."<<endl;
return;
}
 
//Sozdanie novoi bazi dannih 12//
void buildings::input()
{
int i;
cout<<"Vvedite kolichestvo strok:"<<endl;
cin>>n;
cout<<"Vvedite dannie Kinoteatra:"<<endl;
for (i=0;i<n;i++)
{
cout<<i+1<<".";
cout<<"Nomer: "<<endl;
cin>>a[i].d;
cout<<"Naimenovanie: ";
cin>>a[i].name;
cout<<"Nazvanie filma: ";
cin>>a[i].F;
cout<<"Stoimost bileta: ";
cin>>a[i].S;
cout<<"Adres: ";
cin>>a[i].A;
cout<<"Kol-vo mest: ";
cin>>a[i].K;
cout<<endl;
}
cout<<"Dannie vvedeni."<<endl<<endl;
}
0
Programming
Эксперт
39485 / 9562 / 3019
Регистрация: 12.04.2006
Сообщений: 41,671
Блог
07.01.2011, 11:30
Ответы с готовыми решениями:

Обработка данных и структура программы
Обработка данных идет по конвеерной схеме: x -&gt; f1(x) -&gt; f2(f1(x)) -&gt; ... Реализовать это можно двумя способами (далее псевдокод) ...

Структура данных типа стек
Здравствуйте! Я начал изучать С++, в учебном заведении дали задачу, я написал код, но не могу понять в чем именно ошибка. Задача такова:...

Использование файлов и данных типа “структура”
Предусмотреть запись исходных данных в файл и возможность чтения из него. Результат вы-вести на экран и в файл. различные цеха завода...

0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
inter-admin
Эксперт
29715 / 6470 / 2152
Регистрация: 06.03.2009
Сообщений: 28,500
Блог
07.01.2011, 11:30
Помогаю со студенческими работами здесь

Функция для ввода данных типа структура
Здравствуйте. Не могу разобраться с функцией для ввода данных. Присутствуют структуры. Не понимаю что именно надо передать в функцию...

Обработка данных типа запись (комбинированный тип данных).
Вывести ФИО и отметки по физике студентов, имеющих средний балл, больше 4,5. Помоги пожалуйста.... Заранее спасибо)))

Непонятная обработка типа данных
Еще раз здравствуйте. Ситуация следующая. Выполняю SQL запрос: SELECT * FROM dba_tab_columns WHERE TABLE_NAME = 'INORDERS' AND...

Обработка данных комбинированного типа
Условие задачи на картинке. помогите пожалуйста реализовать код

Обработка данных типа запись
Составить программу для решения задачи. Написать программу для ввода списка студентов группы из 25 человек с указанием ФИО, года рождения...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
Новые блоги и статьи
1С: Программный отбор элементов справочника по группе
Maks 22.03.2026
Установка программного отбора элементов справочника "Номенклатура" из модуля формы документа. В качестве фильтра для отбора справочника служит группа номенклатуры. Отбор по наименованию группы. . .
Как я обхитрил таблицу Word
Alexander-7 21.03.2026
Когда мигает курсор у внешнего края таблицы, и нам надо перейти на новую строку, а при нажатии Enter создается новый ряд таблицы с ячейками, то мы вместо нервных нажатий Энтеров мы пишем любые буквы. . .
Krabik - рыболовный бот для WoW 3.3.5a
AmbA 21.03.2026
без регистрации и смс. Это не торговля, приложение не содержит рекламы. Выполняет свою непосредственную задачу - автоматизацию рыбалки в WoW - и ничего более. Однако если админы будут против -. . .
1С: Программный отбор элементов справочника по значению перечисления
Maks 21.03.2026
Установка программного отбора элементов справочника "Сотрудники" из модуля формы документа. В качестве фильтра для отбора служит значение перечислений. / / Событие "НачалоВыбора" реквизита на форме. . .
Переходник USB-CAN-GPIO
Eddy_Em 20.03.2026
Достаточно давно на работе возникла необходимость в переходнике CAN-USB с гальваноразвязкой, оный и был разработан. Однако, все меня терзала совесть, что аж 48-ногий МК используется так тупо: просто. . .
Оттенки серого
Argus19 18.03.2026
Оттенки серого Нашёл в интернете 3 прекрасных модуля: Модуль класса открытия диалога открытия/ сохранения файла на Win32 API; Модуль класса быстрого перекодирования цветного изображения в оттенки. . .
SDL3 для Desktop (MinGW): Рисуем цветные прямоугольники с помощью рисовальщика SDL3 на Си и C++
8Observer8 17.03.2026
Содержание блога Финальные проекты на Си и на C++: finish-rectangles-sdl3-c. zip finish-rectangles-sdl3-cpp. zip
Символические и жёсткие ссылки в Linux.
algri14 15.03.2026
Существует два типа ссылок — символические и жёсткие. Ссылка в Linux — это запись в каталоге, которая может указывать либо на inode «файла-ИСТОЧНИКА», тогда это будет «жёсткая ссылка» (hard link),. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru