2010-12-07 18:41:47 UTC
my editor gave me 2 errors, just dont know what they mean.
: error C2556: 'void main(void)' : overloaded function differs only by return type from 'int main(void)'
: error C2371: 'main' : redefinition; different basic types
thanks in advance!!
#include
struct Student
{
char name[20];
int t1, t2, t3;
float avg;
};
void main()
{
Student s;
printf("enter a name");
gets(s.name);
printf("enter 3 scores");
scanf(" %d %d %d", &s.t1, &s.t2, &s.t3);
s.avg=(s.t1 + s.t2 + s.t3) / (float) 3;
printf("%s\n", s.name);
printf(" %d %d %d %f\n", s.t1, s.t2, s.t3, s.avg);
}
void load (struct Student s[])
{
int i;
for(i=0; i<30; i++);
{
printf("enter name");
gets(s[i].name);
printf("Enter 3 scores");
scanf(" %d %d %d ", &s[i].t1, &s[i].t2, &s[i].t3);
s[i].avg=(s[i].t1 + s[i].t2 + s[i].t3) /(float)3;
fflush(stdin);
}
}
void print(struct Student s[])
{
int i;
for(i=0; i<30; i++);
{
printf("%s\n", s[i].name);
printf("%d %d %d\n", s[i].t1, s[i].t2, s[i].t3);
printf("f\n\n", s[i].avg);
}
}
void sort ( struct Student s[])
{
int i, j;
Student t;
for (i=0; i<29; i++);
for(j=0; j<29; j++);
if(s[j].avg > s[j+1].avg)
{
t=s[j];
s[j]=s[j+1];
s[j+1]= t;
}
}
void main ()
{
Student s[30];
load (s);
print(s);
sort (s);
print (s);
}