closed!

i am having problem debugging a program with
function,while loop,if statement and array ..

i need help ..
tell me how could i combine this 4 ..

Last edited on
We need to see the code to help you
#include <iostream>
using namespace std;

int addition (int a, int b,int c,int d, int e)
{
int r;
r=a+b+c+d+e;
return (r);
}

int main ()
{

int z,y,x,w,v,u,o;
cout<<"\n\nEnter Your 5 grades: \n";
cin>>u>>v>>w>>x>>y;
z = addition (u,v,w,x,y);

o=z/5;
cout<<"\n\nYour Average is : "<<o<<"\n";
if (o>=75){
cout<<"\nCongratulations\nYou Passed the midterm";}
else{
cout<<"\nYou Failed sorry\n";}
system("pause");
return 0;
}


and this



#include <iostream>
using namespace std;
int main()
{
const int finals=5;
int i,ga, g[finals];

for(i=0;i<finals;i++)
{
cout<<"Enter a Grade: ";
cin>>g[i];
int ga;
ga=g[i]+ga;

}
int ave;
ave=ga/5;
cout<<"\n\nYour Average is : "<<ave<<"\n";
if (ave>=75){
cout<<"\nCongratulations\nYou Passed the Finals\n";}
else{
cout<<"\nYou Failed sorry\n";}
system("pause");
return 0;
}

ps the second code i havent perfected it yet :/
And what is your problem? You never said what we're looking for.

Word of advice, use code tags when posting code, and name your variables something useful. I don't understand why no one wants to name variables so people actually know what they're used for
i suggest u use tag codes and also change your first program using arrays
change your first program using arrays
This is C++, use vectors
sorry i've just registered yesterday i havent read do's and dont

im in rush :\
If you can tell us what is wrong, and post it inside of the code tags (when typing, highlight ur text and click the <> button to the side) we can help a lot more than just looking
Topic archived. No new replies allowed.