Nov 15, 2014 at 8:45pm UTC
i cant seem to get the program to return the right grade it keeps returning 0 or 1. i want the program to return true for grades grades greater then or equal to 70 but cant find the right formula to put in the bool(). what formula should i put?
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <string>
using namespace std;
void PopulateArray(int[], int);
bool Pass(int);
int main()
{
const int ARRAY_SIZE = 100;
int quizzes[ARRAY_SIZE];
int x;
PopulateArray(quizzes, ARRAY_SIZE);
for (int index = 0; index < ARRAY_SIZE; index++)
cout << "quiz[" << index << "] = " << quizzes[index]
<< ", your results is) " << (Pass(x)? "pass" : "fail") << endl;
system("pause");
return 0;
}
void PopulateArray(int quizzes[], int size)
{
srand(time(0));
for (int index = 0; index < size; index++)
quizzes[index] = rand() % 101;
}
bool Pass(int grade)
{
return (grade = 70)&&(grade > 70);
}
Nov 16, 2014 at 7:24am UTC
return (grade == 70)||(grade > 70);
or
return (grade >= 70);
Last edited on Nov 16, 2014 at 7:24am UTC
Nov 16, 2014 at 6:28pm UTC
how do i get the code to show only the students that pass over 70?