1 / 1 / 0
Регистрация: 27.10.2012
Сообщений: 26
1

Не работает код, скажите что не так)

17.11.2013, 14:50. Показов 506. Ответов 6
Метки нет (Все метки)

вот код немогу понять почему выдает ошыбки.
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
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iomanip>
 
using namespace std;
 
    
struct building;
{
    const int L=30;
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<<"000"<<endl;
cout<<"   1.Vvod faila "<<endl;
cout<<"   2.Vivod iz faila "<<endl;
cout<<"   3.Alfofitnai 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.Poisk po polu "<<endl;
cout<<"   10.Dobavlenie zapisi v bazu dannih "<<endl;
cout<<"   11.Udalenie zapisi iz bazi dannih "<<endl;
cout<<"   12.Redaktirovanie "<<endl;
cout<<"   13.Sozdanie novoi bazi dannih "<<endl;
cout<<"   14.Konec raboti "<<endl;
cout<<endl<<endl;
cout<<"   Vash vibor 1-14: ";
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.poisk();break;
case 10:a.add();break;
case 11:a.udalenie();break;
case 12:a.redaktirovanie();break;
case 13:a.input();break;
case 14:cout<<"Konec raboti";
    getch();
        return;
    default:cout<<"Net tacogo puncta.";
        getch();break;
     }
 }
 
}
 
//Ïðîãðàììà 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;
}
//Ïðîãðàììà 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();
    }
 //Ïðîãðàììà 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;
    }
 
//Ïðîãðàììà 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;
}
 
//Ïðîãðàììà 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;
}
    
//Ïðîãðàììà 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;
}
 
//Ïðîãðàììà 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;
}
    
//Ïðîãðàììà 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;
 }
    
//Ïðîãðàììà 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;
}
 
//Ïðîãðàììà 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;
}
 
//Ïðîãðàììà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;
}
 
//Ïðîãðàììà 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;
}
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
17.11.2013, 14:50
Ответы с готовыми решениями:

Не работает fopen, скажите что не так плз
Имеется программа по заданию: Дан текст. Написать программу печати всех строк, которые короче 10...

Нужно отделить части адреса как в комментарии к программе. Но почему то не работает. Скажите пожалуйста. Что не так?)
Нужно отделить части адреса как в комментарии к программе. Но почему то не работает. Скажите...

Посмотрите конфиг. скажите что не так или что стоит заменить?
http://kostroma.dns-shop.ru/catalog/cart/?cart_items=138239-1,143321-1,126014-1,157910-1,158182-1,12...

Скажите,что не так?
Здравствуйте! Помогите разобраться, что к чему.В который не раз не получается,нуждаюсь в вашей...

6
584 / 487 / 371
Регистрация: 05.11.2013
Сообщений: 1,262
Записей в блоге: 6
17.11.2013, 15:21 2
C++
1
2
3
struct building;
{
    const int L=30;
дальше можно не читать. "2" за такую мерзость
0
1 / 1 / 0
Регистрация: 27.10.2012
Сообщений: 26
17.11.2013, 15:23  [ТС] 3
Цитата Сообщение от ПерС Посмотреть сообщение
C++
1
2
3
struct building;
{
    const int L=30;
дальше можно не читать. "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
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iomanip>
 
using namespace std;
    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<<"000"<<endl;
cout<<"   1.Vvod faila "<<endl;
cout<<"   2.Vivod iz faila "<<endl;
cout<<"   3.Alfofitnai 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.Poisk po polu "<<endl;
cout<<"   10.Dobavlenie zapisi v bazu dannih "<<endl;
cout<<"   11.Udalenie zapisi iz bazi dannih "<<endl;
cout<<"   12.Redaktirovanie "<<endl;
cout<<"   13.Sozdanie novoi bazi dannih "<<endl;
cout<<"   14.Konec raboti "<<endl;
cout<<endl<<endl;
cout<<"   Vash vibor 1-14: ";
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.poisk();break;
case 10:a.add();break;
case 11:a.udalenie();break;
case 12:a.redaktirovanie();break;
case 13:a.input();break;
case 14:cout<<"Konec raboti";
    getch();
        return;
    default:cout<<"Net tacogo puncta.";
        getch();break;
     }
 }
 
}
 
//Ïðîãðàììà 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;
}
//Ïðîãðàììà 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();
    }
 //Ïðîãðàììà 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;
    }
 
//Ïðîãðàììà 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;
}
 
//Ïðîãðàììà 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;
}
    
//Ïðîãðàììà 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;
}
 
//Ïðîãðàììà 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;
}
    
//Ïðîãðàììà 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;
 }
    
//Ïðîãðàììà 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;
}
 
//Ïðîãðàììà 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;
}
 
//Ïðîãðàììà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;
}
 
//Ïðîãðàììà 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;
}
1
584 / 487 / 371
Регистрация: 05.11.2013
Сообщений: 1,262
Записей в блоге: 6
17.11.2013, 15:28 4
C++
1
2
struct building;
{
; завершает оператор
что ты здесь завершаешь?
0
1 / 1 / 0
Регистрация: 27.10.2012
Сообщений: 26
17.11.2013, 15:29  [ТС] 5
Цитата Сообщение от ПерС Посмотреть сообщение
C++
1
2
struct building;
{
; завершает оператор
что ты здесь завершаешь?
спс поменял но ище 1 ошыбкаможеш глянуть?
0
584 / 487 / 371
Регистрация: 05.11.2013
Сообщений: 1,262
Записей в блоге: 6
17.11.2013, 15:34 6
какая? у меня нет твоего компилятора
0
1 / 1 / 0
Регистрация: 27.10.2012
Сообщений: 26
17.11.2013, 15:41  [ТС] 7
Цитата Сообщение от ПерС Посмотреть сообщение
какая? у меня нет твоего компилятора
все спс сам все сделал)
0
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
17.11.2013, 15:41
Помогаю со студенческими работами здесь

скажите что не так
Разработать программу, которая переводит дюймы в сантиметры. 1 дюйм =2,54см. Построить таблицу...

скажите что не так!
#include &lt;iostream&gt; int main() { long a, b; std::cin &gt;&gt; a; b=b+(a*(a+1))/2); ...

Скажите что не так в сайте!
Подскажите огрехи! Может что то добавить, что то убрать? Все ли впорядке с метатегами? Юзабилен или...

скажите, что не так в запросе??
$query=mysql_query(&quot;SELECT `avatar` FROM `comments` WHERE `article_name`='$name'&quot;);...


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

Или воспользуйтесь поиском по форуму:
7
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2023, CyberForum.ru