This is what I'm trying to do:
The main program will read in a group of three integer values which represent a student's SAT scores. The main program will call a function to determine if these three scores are all valid--valid means in the range from 200 to 800, including both end points, and is a multiple of 10
(ends in a 0).
If the scores are all valid, the main program will call a function (which will itself call other functions) to classify the group of three scores in various ways.
Generally when you ask for help you want to supply some inkling of what you expect and how what's happening differs from what you expect.
Like, if there were compiler errors generated, you might supply them.
Things you might do to address your (unstated) issues:
Read up on how to call a function.
Read up on how one supplies an argument to a function when it is called.
Actually return a value from a function that promises to return a value.
(And since that function probably returns a value for a reason - perhaps you should do something with the value when one is returned.)
// The main program will read in a group of three integer values
// which represent a student's SAT scores.
// The main program will call a function to determine if these three scores
// are all valid--valid means in the range from 200 to 800, including both
// end points, and is a multiple of 10 (ends in a 0).
// If the scores are all valid, the main program will call a function
// (which will itself call other functions) to classify the group of three
// scores in various ways.
#include <iostream>
usingnamespace std;
// What if isitavalidgroup() would return a bool?
int isitavalidgroup(int array[]);
int main()
{
// The main program will read in a group of three integer values
// which represent a student's SAT scores.
int satscores[3];
for loop: // repeats three times
cout << "Please enter one SAT scores: ";
cin >> satscores[] <-- an index is needed here
// "...call a function to determine if these three scores
// are all valid..."
// isitavalidgroup() returns a value.
// It could be a good idea to capture, save or use that value.
isitavalidgroup(int satscores[]); <-- there's an error in the argument list
// "...If the scores are all valid..."
// isitavalidgroup() is what tells you if the three scores are valid
// "...the main program will call a function to classify the group
// of three scores in various ways..."
need another function here...
return 0;
}
int isitavalidgroup(int array[])
{
for(int i=0; i<3; i++)
{
// "...in the range from 200 to 800, including both end points..."
// If one of the three values is out of range
if(int array[i]<200 || int array[i]>800 )
{
// returns an error-code
}
// "...and is a multiple of 10 (ends in a 0)..."
else if() // is the value NOT a multiple of 10?
{
// returns an error code
}
}
return ... <-- a value that means 'all fine'
}
It'd be more prudent to check if an input score is valid first before sending it on to the satscores array (or even better std::vector). Once the scores are already in the array and only then any one of them is found to be invalid we have to start all over again
Given that you've decided to check the group rather than individual scores, which is not as good as checking each one as it is entered, your program should look something like this. You need to read your notes, texts and tutorials :)
Your for loop is missing a set of "{}", so everything after line 14 is not part of the for loop on line 14.
Lines 19, 20 and 22 are not needed if lines 16 and 17 are part of the for loop.
Line 24 is the same proto type as line 4 and not a function call. A function call would be more like aBoolVariavle = isitavalidgroup(array[i]); and should be called after each entry not after the for loop. Also you nee to correct any error before the next iteration of the loop so you do not have to start the program over any time there is an error from input.
Your function at line 33 will not work the way you expect because the function returns a bool which is either 0 or 1; false or true and you are trying to return much more than that.