View Single Post
Old 09-23-2003, 06:40 PM   #1 (permalink)
CoW
Registered User
 
CoW's Avatar
 
Join Date: May 2003
Location: Paris, France
Posts: 31
CoW is on a distinguished road
Send a message via AIM to CoW
Help Please (Need help by Monday 29th of September!)

I cannot get this program to work! Would someone please tell me what I'm doing wrong, and perferably correct my problem!?

[SHELL]
#include <iostream.h>
#include <stdlib.h>

void getValues();
void findLowest();
void calcAverage();

int main()
{

getValues();
findLowest();
calcAverage();

system("PAUSE");
return 0;
}

void getValues()
{
int a,b,c,d,e;
cout << "Please enter 5 test scores (0-100): ";
cin >> a >> b >> c >> d >> e;
if (a>100 || a<0 || b>100 || b<0 || c>100 || c<0 || d>100 || d<0 || e>100 || e<0)
{
cout << "The requirment was between 0 and 100" << endl;
}
}

void findLowest(int a, int b, int c, int d, int e)
{
int& aa=a;
int& bb=b;
int& cc=c;
int& dd=d;
int& ee=e;

int lowest;
int& low=lowest;
if (aa<bb && aa<cc && aa<dd && aa<ee)
{
lowest=aa;
}
if (bb<aa && bb<cc && bb<dd && bb<ee)
{
lowest=bb;
}
if (cc<aa && cc<bb && cc<dd && cc<ee)
{
lowest=cc;
}
if (dd<bb && dd<cc && dd<aa && dd<ee)
{
lowest=dd;
}
if (ee<bb && ee<cc && ee<dd && ee<aa)
{
lowest=ee;
}
cout << "The Lowest Score Was: " << lowest << endl;
}

void calcAverage(int a, int b, int c, int d, int e,int low)
{
int avg;
avg = (((a+b+c+d+e)-low)/4))
cout << "The Average score was: " << avg << endl;
}

[/SHELL]
CoW is offline   Reply With Quote