Error in a program.

hello everyone... i try to do a program for my shool and i have to make it and e-mail it NOW! :( but i cant fint what wrong i make! can someone help me PLZ! i will post the program.
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char lname[240][40];
int am [240];
float less [6][240];
int i=0,j=0,k=0,mini=0,minj=0,maxi=0,les3mini=0,ch;
float les2sum=0,min,les3min;
float lessum[6]={0,0,0,0,0,0};
while(i<240)
{
printf("eisagete to eponimo tou fititi.\n");
scanf("%s",&lname[i]);
printf("eisagete to AM tou fititi.\n");
scanf("%d",&am[i]);
for(j=0;j<6;j++)
{
printf("eisagete to bathmo sto %do mathima\n",j+1);
scanf("%f",&less[j][i]);
}
printf("gia na sunexisete stin eisagogi stoixeion patiste 1\n");
scanf("%d",&ch);
if(ch==1)
{
i++;
continue;
}
else
{
printf("sinexeia stin provoli stoixeion.\n");
k=i;
break;
}
printf("eponimo\t\tAM\t 1_mathima\t 2_mathima\t 3_mathima\t 4_mathima\t 5_mathima\t 6_mathima\n");
for(i=0;j<k;i++)
{
printf("%s\t%d",lname[i],am[i]);
for(j=0;j<6;j++)
{
printf("\t\t%f",less[j][i]);
}
printf("\n");
}
min=less[0][0];
les3min=less[2][0];
for(i=0;j<=k;i++)
{
sm=0;
for(j=0;j<6;j++)
{
if(min>less[j][i])
{
min=less[j][i];
mini=i;
minj=j;
}
sm=sm+less[j][i];
lessum[j]=lessum[j]+less[j][i];
}
mo=sm\6;
sum=sum+mo;
les2sum=les2sum+less[1][i];
if(max<mo)
{
max=mo;
maxi=i;
}
if(les3min>les[2][i])
{
les3min=less[2][i];
les3mini=i;
}
printf("o %dos foititis me arithmo mitroou %d kai eponimo %s exei ti mikroteri bathmologia sto %d mathima me bathmo %f.\n",mini+1,am[mini],lname[mini],minj+1,min);
mo=sum/(k=1);
printf("o genikos mesos oros tis bathmologias olon ton foititon einai %f\n",mo);
printf("o %dos fititis me aritmo mitroou %d kai eponimo %s exei ti megaliteri mesi bathmologia me timi %f.\n",les3mini+1,am[les3mini],lname[les3mini],les3min);
sm=lessum[0];
for(j=1;j<6;j++)
{
if(sm>lessum[j])
{
sm=lessum[i];
minj=j;
}
}
mo=sm/(k+1);
printf("to mathima me ti mikroteri mesi bathmologia einai to %d mathima kai exei meso oro %f\n",minj+1,mo);
system("PAUSE");
return 0;
}
run it if u can and say me whats wrong plzzz! i have to pass this lesson :/
Your compiler tells you what's wrong with it. Go through the error list and fix the errors.
Last edited on
when i try to compile and run i have this error:
sm=0;
C:\Users\Elena\Desktop\Untitled1.cpp In function `int main()':
49 C:\Users\Elena\Desktop\Untitled1.cpp `sm' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
and i dont know what to do :/
You are trying to use a variable sm, in this line:

sm=0;

What is sm? Is it an int? A char? A float? Something else? You never declared it anywhere. It doesn't exist.

Likewise mo, sum, max and les.

As an aside, you're coding in C, not C++.
i dont know how to fix them.... iam new in C++ :/
"sm undeclared" is pretty clear. You initialized the variable sm=0;, but you never declared it at the top. Your compiler doesn't know what type it is so it throws an error.
int i=0
Do you understand what you did here? What this means? It created an int, called i.

Do you see the difference with this line?
sm=0
yes! tnx m8! i will try fix it now! tnx!
Topic archived. No new replies allowed.