Hi all. I'm stuck and wanted to see if you good people could help me out.
I have written the following code:
// This program uses function countPerfect to
// detect how many perfect 100 scores were entered.
#include<iostream>
#include<iomanip>
using namespace std;
// Function prototype
int countPerfect(int[], int);
int main()
{
const int NUM_SCORES = 10;
int scores[NUM_SCORES], perfect = 100;
/**********************************
* countPerfect *
**********************************/
int countPerfect(int array[], int number)
{
int perfScore = 0;
Thanks for the help. That solved one problem, but I can't figure out how to get it to display how many times the user entered a perfect score of 100. Using the sample input above, the program should display: "You entered 2 perfect scores!" No matter how many times I enter 100, It tells me that I entered 100 perfect scores.
/**********************************
* countPerfect *
**********************************/
int countPerfect(int array[], int number)
{
int perfScore = 0;
for (int count = 0; count < number; count++)\
{
if (array[count] == 100)
perfScore++;
}
return perfScore;
}
Tips: the "perfect" you announced in the before in main fun has no meaning,you should change the name such as Sum_Of_PerfectScores which is used to count how many perfect numbers you entered .
If you can't understand the code above ,just post ,we will help u ~