Hello everyone I am having trouble figuring out what is wrong with my program. When I compile the message says "undefined reference to 'WinMain@16' collect2: Id returned 1 exit status". Im not sure if it is because I am running a void function or it could quite possibly be something else. Please Help Im Stuck!
Here is my program.
[code=cpp]
void displayAverage( )
{
double total=0.0; //accumulator variable
double avg=0.0; //average score
double GPA[15]={0.0,0.0,0.0,0 .0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0 ,0.0,0.0,0.0,0. 0};
for (int x=0; x<15; x+=1)//user inputs GPA's & accumulate GPA
{
cout<<"Please enter the GPA"<<endl;
cin>>GPA[x];
total=total+GPA[x];
}//endfor
//calculate avg GPA
avg=total/15.0;
cout<<"The average GPA is: "<<avg<<end l;
//compare avg GPA to individual GPA
for (int x=0; x<15; x+=1)
{
if(GPA[x]>avg)
cout<<GPA[x]<<"is above the average"<<endl;
else
if(GPA[x]<avg)
cout<<GPA[x]<<"is below the average"<<endl;
else
cout<<GPA[x]<<"equals the average"<<endl;
}//end for
return;
}[/code]
Here is my program.
[code=cpp]
void displayAverage( )
{
double total=0.0; //accumulator variable
double avg=0.0; //average score
double GPA[15]={0.0,0.0,0.0,0 .0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0 ,0.0,0.0,0.0,0. 0};
for (int x=0; x<15; x+=1)//user inputs GPA's & accumulate GPA
{
cout<<"Please enter the GPA"<<endl;
cin>>GPA[x];
total=total+GPA[x];
}//endfor
//calculate avg GPA
avg=total/15.0;
cout<<"The average GPA is: "<<avg<<end l;
//compare avg GPA to individual GPA
for (int x=0; x<15; x+=1)
{
if(GPA[x]>avg)
cout<<GPA[x]<<"is above the average"<<endl;
else
if(GPA[x]<avg)
cout<<GPA[x]<<"is below the average"<<endl;
else
cout<<GPA[x]<<"equals the average"<<endl;
}//end for
return;
}[/code]
Comment