Nov 10, 2010 at 9:43pm UTC
i am trying to pass the total number of entries to a function calcaverage and make it average while dropping the lowest grade and returning the average back to main so far here is what i got any help would be appreciated
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
const int GradeArray = 6;
void calcaverage (double userinput)
{
double total =0;
double average;
for (int count =0;count <GradeArray;count++);
total+=GradeArray[count];
}
int main()
{
double userinput[GradeArray];
double total=0,average;
//input grades
cout << "please enter 6 test scores:" <<endl;
for (int count=0;count < GradeArray;count++)
{
cout<< "test #" << (count + 1) <<":" ;
cin >> userinput[count];
calcaverage (userinput);
}
}
Last edited on Nov 11, 2010 at 12:01am UTC
Nov 10, 2010 at 10:56pm UTC
Put your code into proper code tags please.
Nov 10, 2010 at 11:09pm UTC
Me? Working, Diving; Usual life stuff mostly. Just got fed up with all the stupid questions people asked every day so decided to take a break. I'm not really back, just killing some time while I wait for a large compilation at work :)
Nov 11, 2010 at 12:05am UTC
sorry but i seem to still be missing simething here i am trying to pass userinput into the function but continue to get errors like
error C2664: 'calcaverage' : cannot convert parameter 1 from 'double [6]' to 'double'
Nov 11, 2010 at 12:27am UTC
1 2 3 4
void calcAverage(double userInput[])
{
}
Last edited on Nov 11, 2010 at 12:27am UTC
Nov 11, 2010 at 12:43am UTC
i appreciate the help but now iv really gone off the deep end and screwed myself and i could be more confused with my own code (damn) lol
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
const int GradeArray = 6;
void LowestScore()
{
double lowest,count;
double userinput[GradeArray];
lowest=userinput[0];
for (count=0;count<GradeArray;count++)
{
if (userinput[count] < lowest)
lowest=userinput[count];
}
}
void calcaverage (double userinput[])
{
double userinput[GradeArray];
double total =0;
double average;
int count=0;
for (int count =0;count <GradeArray;count++);
{
total+=GradeArray[count];
average=total/GradeArray;
}
}
int main()
{
double userinput[GradeArray];
double total=0,average;
//input grades
cout << "please enter 6 test scores:" <<endl;
for (int count=0;count < GradeArray;count++)
{
cout<< "test #" << (count + 1) <<":" ;
cin >> userinput[count];
double calcaverage (double userinput);
}
}
Last edited on Nov 11, 2010 at 12:47am UTC
Nov 11, 2010 at 1:51am UTC
thanks for the push in the right direction if your interest ill keep you posted
Last edited on Nov 11, 2010 at 1:56am UTC
Nov 12, 2010 at 1:18am UTC
thanks zaita for your help