Ошибка в структуре: Invalid types `int[int]' for array subscript - C (СИ)

Узнай цену своей работы

Формулировка задачи:

Ошибка при работе со структурой:607 D:\Ø\ïðàêòèêà\8\lpr81111.cpp invalid types `int[int]' for array subscript
#include <cstdlib>
#include <iostream>
#include <math.h>
 
using namespace std;
 
struct aeroport{
 
 struct spivrobitniki{
   int kod;
    struct pip{
     char name[10];
     char prizv[10];
     char pb[10];}pib;
     int vik;
     int stat;
     int tel;
    struct pasd{
     int rn;
     char mis[10];
     int datan;
     char vulica[10];
     char misto[10];
     int nbud;
     int nkv;}pass;
   int kodp;}sp;
 
 struct posadi{
  int kodp;
  char namep[10];
  int zp;
  char zobov[10];
  char vimogi[10];}pos[5];
 struct litaki{
  int kodl;
  char marka[10];
  int mistkist;
  int pidyomnist;
  int kodt;
   struct tehhar{
    int visota;
    int vaga;}th;
   struct datav{
    int rik;
    int misyac;
    int chislo;}dv;
  int chas;
   struct datar{
    int rik;
    int misyac;
    int chislo;}dr;
  int kods1;
  int kods2;
  int kods3;}l;
 struct tipl{
  int kodt;
  char name[10];
  char praz[10];
  char obm[10];}tl[5];
 struct ekipaji{
  int kode;
  int chas;
  int kods1;
  int kods2;
  int kods3;}ek;
 struct reisi{
  int kodr;
   struct datar{
    int chislo;
    int misyac;
    int rik;}kr;
  int chas;
  char zvidki[10];
  char kudi[10];
  int kode;
  int kodl;
  int chasp;}r;
 struct kvitki{
   struct pip{
     char name[10];
     char prizv[10];
     char pb[10];}pibp;
   struct pasd{
     int rn;
     char mis[10];
     int datan;
     char vulica[10];
     char misto[10];
     int nbud;
     int nkv;}passp;
  int misce;
  int kodr;
  int cina;}kv;}a[5];
  
float zavd1(){
float a,b,c,s,p,h,v;
printf("vvedit a:");scanf("%f",&a);
printf("vvedit b:");scanf("%f",&b);
printf("vvedit c:");scanf("%f",&c);
printf("vvedit h:");scanf("%f",&h);
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
v=(s*h)/3;
printf("ob'em piramidi:%f\n",h);}
float zavd2(){
float r0,r1,r2,r3;
printf("vvedit r1:");scanf("%f",&r1);
printf("vvedit r2:");scanf("%f",&r2);
printf("vvedit r3:");scanf("%f",&r3);
r0=1/((1/r1)+(1/r2)+(1/r3));
printf("r0=%f\n",r0);}
float zavd3(){
float a,b,c,ia,ib,ic;
printf("vvedit a:");scanf("%f",&a);
printf("vvedit b:");scanf("%f",&b);
printf("vvedit c:");scanf("%f",&c);
ia=sqrt(b*c*(b+c)*(b+c)-a*a)/b+c;
ib=sqrt(a*c*(a+c)*(a+c)-b*b)/a+c;
ic=sqrt(b*a*(b+a)*(b+a)-c*c)/b+a;
printf("bisektrisa 1:%f\nbisektrisa 2:%f\nbisektrisa 3:%f\n",ia,ib,ic);}
int zavd4(){
int x,y,z;
printf("vvedit x:"); scanf("%d",&x);
printf("vvedit y:"); scanf("%d",&y);
printf("vvedit z:"); scanf("%d",&z);
if((x<y)&&(x<z)) printf("x naimenshe\n");else
if((y<x)&&(y<z)) printf("y naimenshe\n");else
if((z<x)&&(z<y)) printf("z naimenshe\n");else
printf("vsi chysla odnakovi\n");}
int zavd5(){
int x,y;
printf("vvedit x:"); scanf("%d",&x);
printf("vvedit y:"); scanf("%d",&y);
if(x<0){
if(x>y) printf("x naibilshe\n");else
if(x<y) printf("y naibilshe\n");}
else {
if(x<y) printf("x naimenshe\n");else
if(y<x) printf("y naimenshe\n");}}
float zavd6(){
float y,x;
printf("vvedit x:");scanf("%f",&x);
y=cos(x*x);
printf("y=%f\n",y);}
int zavd7(){
int nazva_misyaca;
printf("vvedit nomer misyaca:");scanf("%d",&nazva_misyaca);
switch(nazva_misyaca){
case 1:printf("sichen\n");break;
case 2:printf("lutii\n");break;
case 3:printf("berezen\n");break;
case 4:printf("kviten\n");break;
case 5:printf("traven\n");break;
case 6:printf("cherven\n");break;
case 7:printf("lipen\n");break;
case 8:printf("serpen\n");break;
case 9:printf("veresen\n");break;
case 10:printf("jovten\n");break;
case 11:printf("listopad\n");break;
case 12:printf("gruden\n");break;}}
int zavd8(){
int tr,nm;
printf("vvedit tip roku((zvichainii/visokosnii) (0/1)):");scanf("%d",&tr);
switch(tr){
case 0:printf("vvedit nomer misyaca(1...12):");scanf("%d",&nm);
       switch(nm){
       case 1:printf("31\n");break;
       case 2:printf("28\n");break;
       case 3:printf("31\n");break;
       case 4:printf("30\n");break;
       case 5:printf("31\n");break;
       case 6:printf("30\n");break;
       case 7:printf("31\n");break;
       case 8:printf("31\n");break;
       case 9:printf("30\n");break;
       case 10:printf("31\n");break;
       case 11:printf("30\n");break;
       case 12:printf("31\n");break;} break;
case 1:printf("vvedit nomer misyaca(1...12):");scanf("%d",&nm);
       switch(nm){
       case 1:printf("31\n");break;
       case 2:printf("29\n");break;
       case 3:printf("31\n");break;
       case 4:printf("30\n");break;
       case 5:printf("31\n");break;
       case 6:printf("30\n");break;
       case 7:printf("31\n");break;
       case 8:printf("31\n");break;
       case 9:printf("30\n");break;
       case 10:printf("31\n");break;
       case 11:printf("30\n");break;
       case 12:printf("31\n");break;}}}
int zavd9(){
char s1[10],s2[10],s3[10],s4[10],s5[10];
int d1,d2,d3,d4,d5,i;
printf("vvedit ryadok n1:"); scanf("%s",&s1);
printf("vvedit ryadok n2:"); scanf("%s",&s2);
printf("vvedit ryadok n3:"); scanf("%s",&s3);
printf("vvedit ryadok n4:"); scanf("%s",&s4);
printf("vvedit ryadok n5:"); scanf("%s",&s5);
d1=strlen(s1);
d2=strlen(s2);
d3=strlen(s3);
d4=strlen(s4);
d5=strlen(s5);
if((d1>d2)&&(d1>d3)&&(d1>d4)&&(d1>d5)) printf("ryadok n1-naibilshii\n");
if((d2>d1)&&(d2>d3)&&(d2>d4)&&(d2>d5)) printf("ryadok n2-naibilshii\n");
if((d3>d1)&&(d3>d2)&&(d3>d4)&&(d3>d5)) printf("ryadok n3-naibilshii\n");
if((d4>d1)&&(d4>d2)&&(d4>d3)&&(d4>d5)) printf("ryadok n4-naibilshii\n");
if((d5>d1)&&(d5>d2)&&(d5>d3)&&(d5>d4)) printf("ryadok n5-naibilshii\n");
}
int zavd10(){
char s1[10],s2[10],s3[10],s4[10],s5[10];
int d1,d2,d3,d4,d5,i;
printf("vvedit ryadok n1:"); scanf("%s",&s1);
printf("vvedit ryadok n2:"); scanf("%s",&s2);
printf("vvedit ryadok n3:"); scanf("%s",&s3);
printf("vvedit ryadok n4:"); scanf("%s",&s4);
printf("vvedit ryadok n5:"); scanf("%s",&s5);
d1=strlen(s1);
d2=strlen(s2);
d3=strlen(s3);
d4=strlen(s4);
d5=strlen(s5);
if((d1<d2)&&(d1<d3)&&(d1<d4)&&(d1<d5)) printf("ryadok n1-naimenshii\n");
if((d2<d1)&&(d2<d3)&&(d2<d4)&&(d2<d5)) printf("ryadok n2-naimenshii\n");
if((d3<d1)&&(d3<d2)&&(d3<d4)&&(d3<d5)) printf("ryadok n3-naimenshii\n");
if((d4<d1)&&(d4<d2)&&(d4<d3)&&(d4<d5)) printf("ryadok n4-naimenshii\n");
if((d5<d1)&&(d5<d2)&&(d5<d3)&&(d5<d4)) printf("ryadok n5-naimenshii\n");}
int zavd41(int m1[])
{
    int imax = 0,i;
    for (int i = 1; i < 14; ++i)
        if (m1[imax] < m1[i])
            imax = i;
    return imax;
}
 
int zavd42(int m[]){
    int d=1,i=0;
    while(m[i]!=0){
                   d=d*m[i];
                   i++;
                   }
    return d;}
    
int zavd43(int m1[]){
    int i,s=0;
    for(i=0;i<=9;i=i+2)
    s=s+m1[i];
    return s;}
    
int zavd46(int m1[2][3])
{
    int i, j, max;
    max = m1[0][0];
    for (i = 0; i <= 1; i++)
        for (j = 0; j <= 2; j++)
        {
            if (m1[i][j] > max)
                max = m1[i][j];
        }
    for (i = 0; i <= 1; i++)
        for (j = 0; j <= 2; j++)
        {
            m1[i][j] = m1[i][j] / max;
        }
   printf("Result:\n");
    for (i = 0; i <= 1; ++i) 
        for (j = 0; j <= 2; ++j)
            printf("%d\t", m1[i][j]);
                        
}
      
int zavd45(int m1[5][5]){
    int i,j,s=0;
    for (i=0;i<4/2;i++)
    for (j=i+1;j<4-i;j++)
    s=s+m1[i][j];
    for (i=4/2;i<5;i++)
    for (j=i+1;j<4+i;j++)
    s=s+m1[i][j];
    return s;}
    
int  zavd44(int m1[],int m2[6][6]){
    int i,j;
    for (i = 0; i < 5; i += 2)
        for (j = 0; j < 5; ++j)
            m2[i][j] = m1[i];
    printf("res:\n");
    for(i=0;i<=5;i++)
    for(j=0;j<=5;j++){
                         printf("%d\n",m2[i][j]);}
  }

int main(int argc, char *argv[])
{
    int zavd,exit,s324=0,d122=1,s22=0;
m1: printf("vvedit N praktichnoi:");scanf("%d",&zavd);
    switch(zavd)
    {
    case 1:
           int a,b,sa,sg,g;
           printf("Zavdannya n1\n");
           printf("vvedit a:"); scanf("%d",&a);
           printf("vvedit b:"); scanf("%d",&b);
           if(a<0) a=-a;
           if(b<0) b=-b;
           sa=(a+b)/2;
           sg=sqrt(a*b);
           printf("seredne arifmetichne:%d\nserednye geometrichne:%d\n",sa,sg);
 
           printf("Zavdannya n2\n");
           float a1,b1,c21,m,m1,m2;
           printf("vvedit a1:"); scanf("%f",&a1);
           printf("vvedit b1:"); scanf("%f",&b1);
           printf("vvedit c1:"); scanf("%f",&c21);
           m=0.5*sqrt(2*(b1*b1+c21*c21)-a1*a1);
           m1=0.5*sqrt(2*(a1*a1+c21*c21)-b1*b1);
           m2=0.5*sqrt(2*(a1*a1+b1*b1)-c21*c21);
           printf("mediani:\na=%f\nb=%f\nc=%f\n",m,m1,m2);

           printf("Zavdania 3\n");
           int x,y,z;
           printf("vvedit x:"); scanf("%d",&x);
           printf("vvedit y:"); scanf("%d",&y);
           printf("vvedit z:"); scanf("%d",&z);
           if((x>y)&&(x>z)) printf("x naybilshe\n");else
           if((y>x)&&(y>z)) printf("y naybilshe\n");else
           if((z>x)&&(z>y)) printf("z naybilshe\n");else
           printf("vsi chysla odnakovi\n");

           printf("Zavdannya n4\n");
           int x1,y1,z1,n4,n41,n42;
           printf("vvedit x:"); scanf("%d",&x1);
           printf("vvedit y:"); scanf("%d",&y1);
           printf("vvedit z:"); scanf("%d",&z1);
           if(x1>0)
           {
           n4=x1*x1;
           printf("x^2=%d\n",n4);
           }
           if(y1>0)
           {
           n41=y1*y1;
           printf("y^2=%d\n",n41);
           }
           if(z1>0)
           {
           n42=z1*z1;
           printf("z^2=%d\n",n42);
           }

           printf("zavdanya n5\n");
           int n5;
           printf("vvedit vik ludini:"); scanf("%d",&n5);
           if((n5==1)||(n5==21)||(n5==31)||(n5==41)||(n5==51)||(n5==61)||(n5==71)||(n5==81)||(n5==91))
           {
           printf("%d rik\n",n5);
           }else
           if((n5==2)||(n5==3)||(n5==4)||(n5==22)||(n5==23)||(n5==24)||(n5==32)||(n5==33)||(n5==34)||(n5==42)||(n5==43)||(n5==44)||(n5==52)||(n5==53)||(n5==54)||(n5==62)||(n5==63)||(n5==64)||(n5==62)||(n5==63)||(n5==64)||(n5==72)||(n5==73)||(n5==74)||(n5==82)||(n5==83)||(n5==84)||(n5==92)||(n5==93)||(n5==94))
           {
           printf("%d roki\n",n5);} else
           printf("%d rokiv\n",n5);

           printf("zavdanya n6\n");
           int den;
           printf("vvedit den tijnya:"); scanf("%d",&den);
           switch(den)
           {
           case 1:printf("ponedilok\n");break;
           case 2:printf("vivtorok\n");break;
           case 3:printf("sereda\n");break;
           case 4:printf("chetver\n");break;
           case 5:printf("pyatnica\n");break;
           case 6:printf("subota\n");break;
           case 7:printf("nedilya\n");break;
           }
 
           printf("zavdanya n7\n");
           int n7;
           printf("vvedit chislo:");scanf("%d",&n7);
           n7%=10;
           n7*=n7;
           n7%=10;
           printf("res:%d\n",n7);
 
           printf("zavdanya n8\n");
           char s1[10],s2[10],s3[10],s4[10],s5[10],s6[10],s7;
           int s8;
           printf("vvedit ryadok N1:");scanf("%s",&s1);
           printf("vvedit ryadok N2:");scanf("%s",&s2);
           printf("vvedit ryadok N3:");scanf("%s",&s3);
           printf("vvedit ryadok N4:");scanf("%s",&s4);
           printf("vvedit ryadok N5:");scanf("%s",&s5);
           printf("vvedit ryadok N6:");scanf("%s",&s6);
           strcat(s1,s2);
           strcat(s1,s3);
           strcat(s1,s4);
           strcat(s1,s5);
           strcat(s1,s6);
           s7=strlen(s1);
           printf("dovgina %d\n",s7);

           printf("zavdanya n9\n");
           char s19[10],s29[10],s39[10],s49[10];
           printf("vvedit ryadok N1:");scanf("%s",&s19);
           printf("vvedit ryadok N2:");scanf("%s",&s29);
           printf("vvedit ryadok N3:");scanf("%s",&s39);
           printf("vvedit ryadok N4:");scanf("%s",&s49);
           strcat(s19,s29);
           strcat(s19,s39);
           strcat(s19,s49);
           printf("pidryadok:%s\n",s19);
           /*printf("zavdanya n10:\n");
        char str[256];
        char *ptr;
        int c1 = 0;
        std::cin.getline(str,256);
        ptr = strtok(str," ");
        while(ptr != NULL)
        {
                if(!strcmp(ptr,"kit"))               
                c1++;
                ptr = strtok(NULL, " ");
        }
        cout << c1 <<"\n";*/
        printf("povernutis do poper menu(1)");
        scanf("%d",&exit);
        switch(exit){case 1:goto m1;}break;
   case 2:
        printf("prn2\nzavdanya n1\n");
        int m22[10],i2;
        printf("vvedit massiv:");
        for(i2=0;i2<=92;i2++)
        {
        scanf("%d",&m22[i2]);
        }
        i2=0;
        while(m22[i2]!=0)
        {
        s22=s22+m22[i2];i2++;
        }
        printf("suma:%d\n",s22);
 
        printf("zavdanya n2\n");
        int m12[10],i12;
        printf("vvedit massiv:");
        for(i12=0;i12<=9;i12++)
        {
        scanf("%d",&m12[i12]);
        if(m12[i12]<0){
        d122=d122*m12[i12];}
        }
        printf("dobutok vid'emnih elementiv:%d\n",d122);
 
        printf("zavdanya n3\n");
        int m222[9],i22;
        for(i22=0;i22<=8;i22++)
        {
        m222[i22]=sqrt(i22);
        printf("%d\n",m222[i22]);
        }
 
        printf("zavdanya n4\n");
        int m324[5][5],i32,g32;
        printf("vvedit masiv:");
        for(i32=0;i32<=4;i32++){
        for(g32=0;g32<=4;g32++){
        scanf("%d",&m324[i32][g32]);
        if(i32==0) s324=s324+m324[i32][g32];
        if(i32==4) s324=s324+m324[i32][g32];
        if(g32==0) s324=s324+m324[i32][g32];
        if(g32==4) s324=s324+m324[i32][g32];
        }
        }
        printf("suma:%d\n",s324);
 
        printf("zavdanya n5\n");
        int i42, j42, a42[7][7];
        for(j42=0; j42<6; j42++)
        a42[0][j42]=2.*(j42+1)+3.;
        for(j42=0; j42<6; j42++)
        a42[1][j42]=(double)(j42+1)-3./(2.+1./(j42+1));
        for(i42=2; i42<6; i42++)
        for(j42=0; j42<6; j42++){
        a42[i42][j42]=a42[i42-1][j42]+a42[i42-2][j42];
        printf("mas:%d\n",a42[i42][j42]);}
 
        printf("zavdanya n6\n");
        int m52[6][6],i52,g52,max52;
        printf("vvedit masiv:");
        for(i52=0;i52<=5;i52++)
        for(g52=0;g52<=5;g52++){scanf("%d",&m52[i52][g52]);}
        for(i52=0;i52<=5;i52++)
        for(g52=0;g52<=5;g52++){
        if(max52<m52[i52][g52])
        max52=m52[i52][g52];}
        for(i52=0;i52<=5;i52++)
        for(g52=0;g52<=5;g52++){
        if(max52==m52[i52][g52])
        printf("i=%d, j=%d\n",i52,g52);}
        printf("povernutis do poper menu(1)");
        scanf("%d",&exit);
        switch(exit){case 1:goto m1;}break;
case 3:
     printf("pr n3\nzavdanya n1\n");
zavd1();
 
printf("zavdanya n2\n");
zavd2();
 
printf("zavdanya n3\n");
zavd3();
 
printf("zavdanya n4\n");
zavd4();
 
printf("zavdanya n5\n");
zavd5();
 
printf("zavdanya n6\n");
zavd6();
 
printf("zavdanya n7\n");
zavd7();
 
printf("zavdanya n8\n");
zavd8();
 
printf("zavdanya n9\n");
zavd9();
 
printf("zavdanya n10\n");
zavd10();
printf("povernutis do poper menu(1)");
        scanf("%d",&exit);
        switch(exit){case 1:goto m1;}break;
case 4:      
        int m4[15], i4, imax4;
    printf("pr n4\nzavdanya n1:\n");
    printf("vvedit masiv z 15 chisel:");
    for (i4 = 0; i4 < 14; ++i4)
        scanf("%d", &m4[i4]);
    imax4 = zavd41(m4);
    printf("max=%d\ni=%d\n", m4[imax4], imax4);

    printf("zavdanya n2:\n");
    int m41[10],i41;
    printf("vedit masiv z 10 chisel:\n");
    for(i41=0;i41<=9;i41++)
    scanf("%d",&m41[i41]);
    printf("dobutok do pershogo 0:%d\n",zavd42(m41));

    printf("zavdanya n3:\n");
    int m42[10],i432;
    printf("vedit masiv z 10 chisel:\n");
    for(i432=0;i432<=9;i432++)
    scanf("%d",&m42[i432]);
    printf("suma elementiv shcho stouat na parnih mistah:%d\n",zavd43(m42));

    printf("zavdanya n4:\n:");
    int m43[6],m432[6][6],i43,j43;
    printf("vvedit masiv z 6 chisel:");
    for(i43=0;i43<=5;i43++)
    scanf("%d",&m43[i43]);
    printf("vvedit masiv z 36 chisel:");
    for(i43=0;i43<=5;i43++)
    for(j43=0;j43<=5;j43++){
                         scanf("%d",&m432[i43][j43]);}
    zavd44(m43,m432);

     printf("zavdanya n5:\n");
     int m44[5][5],i44,j44;
     for(i44=0;i44<=4;i44++)
     for(j44=0;j44<=4;j44++){
     scanf("%d",&m44[i44][j44]);}
     printf("suma:%d\n",zavd45(m44));

    printf("zavdanya n6:\n");
    int m45[2][3], i45, j45;
    printf("vvedit masiv z 6 chisel:\n");
    for (i45 = 0; i45 <= 1; ++i45)
        for (j45 = 0; j45 <= 2; ++j45)
            scanf("%d", &m45[i45][j45]);
    zavd46(m45);
    printf("povernutis do poper menu(1)");
        scanf("%d",&exit);
        switch(exit){case 1:goto m1;}break;
 case 5:
           int i5;
int kods,kodl,kodr;
printf("pr n5\n");
for(i5=1;i5<=5;i5++)
{
printf("vvedit kod spivrobitnika    N %d:",i5);scanf("%d",&a[i5].sp.kod);
printf("vvedit im'a                 N %d:",i5);scanf("%s",&a[i5].sp.pib.name);
printf("vvedit prizvishche          N %d:",i5);scanf("%s",&a[i5].sp.pib.prizv);
printf("vvedit po-batkovi           N %d:",i5);scanf("%s",&a[i5].sp.pib.pb);
printf("vvedit vik                  N %d:",i5);scanf("%d",&a[i5].sp.vik);
printf("vvedit stat                 N %d:",i5);scanf("%s",&a[i5].sp.stat);
printf("vvedit telefon              N %d:",i5);scanf("%d",&a[i5].sp.tel);
printf("vvedit rik nar.             N %d:",i5);scanf("%d",&a[i5].sp.pass.rn);
printf("vvedit nazvu misyaca nar.   N %d:",i5);scanf("%s",&a[i5].sp.pass.mis);
printf("vvedit datu nar.            N %d:",i5);scanf("%d",&a[i5].sp.pass.datan);
printf("vvedit nazvu vulici         N %d:",i5);scanf("%s",&a[i5].sp.pass.vulica);
printf("vvedit nazvu mista          N %d:",i5);scanf("%s",&a[i5].sp.pass.misto);
printf("vvedit nomer budinku        N %d:",i5);scanf("%d",&a[i5].sp.pass.nbud);
printf("vvedit nomer kv.            N %d:",i5);scanf("%d",&a[i5].sp.pass.nkv);
printf("vvedit kod posadi           N %d:",i5);scanf("%d",&a[i5].sp.kodp);
 
printf("vvedit kod posadi           N %d:",i5);scanf("%d",&a[i5].pos.kodp);
printf("vvedit naim. posadi         N %d:",i5);scanf("%s",&a[i5].pos.namep);
printf("vvedit zarobitnu platu      N %d:",i5);scanf("%d",&a[i5].pos.zp);
printf("vvedit zobovazanya          N %d:",i5);scanf("%s",&a[i5].pos.zobov);
printf("vvedit vimogi               N %d:",i5);scanf("%s",&a[i5].pos.vimogi);
 
printf("vvedit kod litaka           N %d:",i5);scanf("%d",&a[i5].l.kodl);
printf("vvedit marku                N %d:",i5);scanf("%s",&a[i5].l.marka);
printf("vvedit mistkist             N %d:",i5);scanf("%d",&a[i5].l.mistkist);
printf("vvedit pidyomnist           N %d:",i5);scanf("%d",&a[i5].l.pidyomnist);
printf("vvedit kod tipu             N %d:",i5);scanf("%d",&a[i5].l.kodt);
printf("vvedit visotu               N %d:",i5);scanf("%d",&a[i5].l.th.visota);
printf("vvedit vagu                 N %d:",i5);scanf("%d",&a[i5].l.th.vaga);
printf("vvedit rik vipusku          N %d:",i5);scanf("%d",&a[i5].l.dv.rik);
printf("vvedit N misyaca vipusku    N %d:",i5);scanf("%d",&a[i5].l.dv.misyac);
printf("vvedit chislo vipusku       N %d:",i5);scanf("%d",&a[i5].l.dv.chislo);
printf("vvedit char pol'otiv        N %d:",i5);scanf("%d",&a[i5].l.chas);
printf("vvedit rik remontu          N %d:",i5);scanf("%d",&a[i5].l.dr.rik);
printf("vvedit misyac remontu       N %d:",i5);scanf("%d",&a[i5].l.dr.misyac);
printf("vvedit chislo remontu       N %d:",i5);scanf("%d",&a[i5].l.dr.chislo);
printf("vvedit kod spivrobitnika N1 N %d:",i5);scanf("%d",&a[i5].l.kods1);
printf("vvedit kod spivrobitnika N2 N %d:",i5);scanf("%d",&a[i5].l.kods2);
printf("vvedit kod spivrobitnika N3 N %d:",i5);scanf("%d",&a[i5].l.kods3);
 
printf("vvedit kod tipu litaka      N %d:",i5);scanf("%d",&a[i5].tl.kodt);
printf("vvedit naimenuvannya litaka N %d:",i5);scanf("%s",&a[i5].tl.name);
printf("vvedit priznechenya litaka  N %d:",i5);scanf("%s",&a[i5].tl.praz);
printf("vvedit obmegennya litaka    N %d:",i5);scanf("%s",&a[i5].tl.obm);
 
printf("vvedit kod ekipaja          N %d:",i5);scanf("%d",&a[i5].ek.kode);
printf("vvedit naletano godin       N %d:",i5);scanf("%d",&a[i5].ek.chas);
printf("vvedit kod spivrobitnika N1 N %d:",i5);scanf("%d",&a[i5].ek.kods1);
printf("vvedit kod spivrobitnika N2 N %d:",i5);scanf("%d",&a[i5].ek.kods2);
printf("vvedit kod spivrobitnika N3 N %d:",i5);scanf("%d",&a[i5].ek.kods3);
 
printf("vvedit kod reisu            N %d:",i5);scanf("%d",&a[i5].r.kodr);
printf("vvedit chislo               N %d:",i5);scanf("%d",&a[i5].r.kr.chislo);
printf("vvedit nomer misyaca        N %d:",i5);scanf("%d",&a[i5].r.kr.misyac);
printf("vvedit rik                  N %d:",i5);scanf("%d",&a[i5].r.kr.rik);
printf("vvedit chas vidlotu         N %d:",i5);scanf("%d",&a[i5].r.chas);
printf("vvedit tochku vidpravlenya  N %d:",i5);scanf("%s",&a[i5].r.zvidki);
printf("vvedit tochku priznachenya  N %d:",i5);scanf("%s",&a[i5].r.kudi);
printf("vvedit kod ekipagu          N %d:",i5);scanf("%d",&a[i5].r.kode);
printf("vvedit kod litaka           N %d:",i5);scanf("%d",&a[i5].r.kodl);
printf("vvedit chas polotu          N %d:",i5);scanf("%d",&a[i5].r.chasp);
 
printf("vvedit im'a pas.            N %d:",i5);scanf("%s",&a[i5].kv.pibp.name);
printf("vvedit prizvishche pas.     N %d:",i5);scanf("%s",&a[i5].kv.pibp.prizv);
printf("vvedit po-batkovi pas.      N %d:",i5);scanf("%s",&a[i5].kv.pibp.pb);
printf("vvedit rik nar.             N %d:",i5);scanf("%d",&a[i5].kv.passp.rn);
printf("vvedit nazvu misyaca nar    N %d:",i5);scanf("%s",&a[i5].kv.passp.mis);
printf("vvedit datu nar.            N %d:",i5);scanf("%d",&a[i5].kv.passp.datan);
printf("vvedit nazvu vulici         N %d:",i5);scanf("%s",&a[i5].kv.passp.vulica);
printf("vvedit nazvu mista          N %d:",i5);scanf("%s",&a[i5].kv.passp.misto);
printf("vvedit N budinku            N %d:",i5);scanf("%d",&a[i5].kv.passp.nbud);
printf("vvedit N kvartiri           N %d:",i5);scanf("%d",&a[i5].kv.passp.nkv);
printf("vvedit misce                N %d:",i5);scanf("%d",&a[i5].kv.misce);
printf("vvedit kod reisu            N %d:",i5);scanf("%d",&a[i5].kv.kodr);
printf("vvedit cinu                 N %d:",i5);scanf("%d",&a[i5].kv.cina);
}
printf("vvedit kod spivrobitnika:");scanf("%d",&kods);
printf(" Spivrobitniki:");
for(i5=1;i5<=5;i5++){
if(kods==a[i5].sp.kod)
{
printf("   kod spivrobitnika    N %d:%d\n",i5,a[i5].sp.kod);
printf("   im'a                 N %d:%s\n",i5,a[i5].sp.pib.name);
printf("   prizvishche          N %d:%s\n",i5,a[i5].sp.pib.prizv);
printf("   po-batkovi           N %d:%s\n",i5,a[i5].sp.pib.pb);
printf("   vik                  N %d:%d\n",i5,a[i5].sp.vik);
printf("   stat                 N %d:%s\n",i5,a[i5].sp.stat);
printf("   telefon              N %d:%d\n",i5,a[i5].sp.tel);
printf("   rik nar.             N %d:%d\n",i5,a[i5].sp.pass.rn);
printf("   nazvu misyaca nar.   N %d:%s\n",i5,a[i5].sp.pass.mis);
printf("   datu nar.            N %d:%d\n",i5,a[i5].sp.pass.datan);
printf("   nazvu vulici         N %d:%s\n",i5,a[i5].sp.pass.vulica);
printf("   nazvu mista          N %d:%s\n",i5,a[i5].sp.pass.misto);
printf("   nomer budinku        N %d:%d\n",i5,a[i5].sp.pass.nbud);
printf("   nomer kv.            N %d:%d\n",i5,a[i5].sp.pass.nkv);
printf("   kod posadi           N %d:%d\n\n",i5,a[i5].sp.kodp);
}
}
 
printf("vvedit tip litaka:");scanf("%d",&kodl);
printf(" Tipi litakiv:\n");
for(i5=1;i5<=5;i5++)
{
if(kodl==a[i5].l.kodl)
{
printf("   kod litaka           N %d:%d\n",i5,a[i5].l.kodl);
printf("   marku                N %d:%s\n",i5,a[i5].l.marka);
printf("   mistkist             N %d:%d\n",i5,a[i5].l.mistkist);
printf("   pidyomnist           N %d:%d\n",i5,a[i5].l.pidyomnist);
printf("   kod tipu             N %d:%d\n",i5,a[i5].l.kodt);
printf("   visota               N %d:%d\n",i5,a[i5].l.th.visota);
printf("   vaga                 N %d:%d\n",i5,a[i5].l.th.vaga);
printf("   rik vipusku          N %d:%d\n",i5,a[i5].l.dv.rik);
printf("   N misyaca vipusku    N %d:%d\n",i5,a[i5].l.dv.misyac);
printf("   chislo vipusku       N %d:%d\n",i5,a[i5].l.dv.chislo);
printf("   char pol'otiv        N %d:%d\n",i5,a[i5].l.chas);
printf("   rik remontu          N %d:%d\n",i5,a[i5].l.dr.rik);
printf("   misyac remontu       N %d:%d\n",i5,a[i5].l.dr.misyac);
printf("   chislo remontu       N %d:%d\n",i5,a[i5].l.dr.chislo);
printf("   kod spivrobitnika N1 N %d:%d\n",i5,a[i5].l.kods1);
printf("   kod spivrobitnika N2 N %d:%d\n",i5,a[i5].l.kods2);
printf("   kod spivrobitnika N3 N %d:%d\n",i5,a[i5].l.kods3);
printf("   naimenuvannya litaka N %d:%s\n",i5,a[i5].tl.name);
printf("   priznechenya litaka  N %d:%s\n",i5,a[i5].tl.praz);
printf("   obmegennya litaka    N %d:%s\n\n",i5,a[i5].tl.obm);
}
}
 
printf("vvedit kod reisu:");scanf("%d",&kodr);
printf(" Kvitki:\n");
for(i5=1;i5<=5;i5++)
{
if(kodr==a[i5].kv.kodr)
{
printf("   im'a pas.            N %d:%s\n",i5,a[i5].kv.pibp.name);
printf("   prizvishche pas.     N %d:%s\n",i5,a[i5].kv.pibp.prizv);
printf("   po-batkovi pas.      N %d:%s\n",i5,a[i5].kv.pibp.pb);
printf("   rik nar.             N %d:%d\n",i5,a[i5].kv.passp.rn);
printf("   nazvu misyaca nar    N %d:%s\n",i5,a[i5].kv.passp.mis);
printf("   datu nar.            N %d:%d\n",i5,a[i5].kv.passp.datan);
printf("   nazvu vulici         N %d:%s\n",i5,a[i5].kv.passp.vulica);
printf("   nazvu mista          N %d:%s\n",i5,a[i5].kv.passp.misto);
printf("   N budinku            N %d:%d\n",i5,a[i5].kv.passp.nbud);
printf("   N kvartiri           N %d:%d\n",i5,a[i5].kv.passp.nkv);
printf("   misce                N %d:%d\n",i5,a[i5].kv.misce);
printf("   kod reisu            N %d:%d\n",i5,a[i5].kv.kodr);
printf("   cinu                 N %d:%d\n\n",i5,a[i5].kv.cina);
}
}      

        }
 
    system("PAUSE");
    return EXIT_SUCCESS;
}

Решение задачи: «Ошибка в структуре: Invalid types `int[int]' for array subscript»

textual
Листинг программы
printf("vvedit kod spivrobitnika    N %d:",i5);scanf("%d",&a[i5].sp.kod);

Объяснение кода листинга программы

В данном коде выполняется ввод кода сотрудника с помощью функции scanf. Ввод осуществляется в переменную a[i5].sp.kod. a является массивом, i5 — индексом в этом массиве. sp — это структура, в которой содержится информация о сотруднике. kod — это поле структуры sp, в которое осуществляется ввод кода сотрудника.

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

15   голосов , оценка 4 из 5