Code:
#include <stdio.h>
#include <string.h>
int athr=0;
int i,j;
/* 1st function */
void sin_tetr(struct polikatoikia[5][10])
{
for (i=1;i<6;i++)
{
for (j=1;j<11;j++)
{
athr=athr+polikatoikia[i][j].tetr_metra;
}
printf("Total sum of %d floor: %d \n", i,athr);
athr=0;
}
}
/* My structure */
struct diamerisma
{
char name[50];
int arithm_diam;
int tetr_metra;
int orofos;
};
/* The data of the structures */
struct diamerisma d101;
strcpy(d101.name,"Katoikos 101"); //keno meta tin parenthesi?
d101.arithm_diam=101;
d101.tetr_metra=50;
d101.orofos=1;
/* ommited 102 to 509 for this post */
struct diamerisma d510;
strcpy( d510.name, "Katoikos 510");
d510.arithm_diam=510;
d510.tetr_metra=40;
d510.orofos=5;
/* My array of the structures */
struct diamerisma polikatoikia[5][10]={
{d101, d102, d103, d104, d105, d106, d107, d108, d109, d110},
{d201, d202, d203, d204, d205, d206, d207, d208, d209, d210},
{d301, d302, d303, d304, d305, d306, d307, d308, d309, d310},
{d401, d402, d403, d404, d405, d406, d407, d408, d409, d410},
{d501, d502, d503, d504, d505, d506, d507, d508, d509, d510}
};
/* MAIN not yet finished nor calling functions */
int main()
{
printf("Select a-d \n");
scanf("%c", &option);
switch(option)
{
case 'a' :
break;
case 'b' :
break;
case 'c' :
break;
case 'd' :
break;
default :
printf("Lathos epilogi.\n");
}
return 0;
}
When I try to compile with gcc on linux, I get many errors though they seem to be coming from 2 main problems :