language: AWK (mawk) (mawk-1.3.3)
date: 333 days 22 hours ago
link:
visibility: public
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
#include <string.h>
#include <iostream>
 
#include <math.h>
#include <stdlib.h>
using namespace std;
int const n=5;
void main(){int i,k,q,j=0; char s[25], d[25];
struct bibl
        {       char name[25];
        char ath[25];           
        char id [20];           
        int god;                        
        int ras;                
                
        };
bibl m[n];
for(i=0;i<n;i++){
cout<<"vvedite nazvanie:"; cin>>m[i].name; cout<<"\n";
cout<<"vvedite avtora:"; cin>>m[i].ath; cout<<"\n";
cout<<"vvedite shifr:"; cin>>m[i].id; cout<<"\n";
cout<<"vvedite god:"; cin>>m[i].god; cout<<"\n";
cout<<"vvedite raspolozhenie:"; cin>>m[i].ras; cout<<"\n";
}
cout<<"vvedite 1, esli hotite naiti knigu, 2 - esli vse knigi odnogo avtora ili 3, esli hotite vse knigi odnogo goda:";
cin>>k;
 
switch(k){
case 1:
cout<<"vvedite avtora:";
cin>>s;
cout<<"vvedite nazvanie:";
cin>>d;
for(i=0;i<n;i++){
if(!strcmp(m[i].ath,s) && !strcmp(m[i].name,d)){
cout<<m[i].ras<<endl;}
break;
case 2:
cout<<"vvedite avtora:";
cin>>s;
for(i=0;i<n;i++){
if(!strcmp(m[i].ath,s)){
cout<<m[i].name<<endl;}
break;
case 3:
cout<<"vvedite god:";
cin>>q;
if(m[i].god==q){j++;}
cout<<j<<endl;
break;
dafault:
cout<<"vi vveli nevernoe znachenie";
}
 
 
}
 
  • upload with new input
  • result: Success     time: 0s    memory: 1952 kB     returned value: 2

    mawk: prog.awk: line 7: syntax error at or near const
    mawk: prog.awk: line 8: syntax error at or near ,
    mawk: prog.awk: line 13: syntax error at or near god
    mawk: prog.awk: line 14: syntax error at or near ras
    mawk: prog.awk: line 19: syntax error at or near <