how to pass an array into an function and in the function count how many numbers are in a range?
- by user320950
#include <iostream>
#include <fstream>
using namespace std;
int calculate_total(int exam1[], int exam2[], int exam3[]); // function that calcualates grades to see how many 90,80,70,60
int exam1[100];// array that can hold 100 numbers for 1st column
int exam2[100];// array that can hold 100 numbers for 2nd column
int exam3[100];// array that can hold 100 numbers for 3rd column
// here i am passing an array into the function calcualate_total
int calculate_total(exam1[],exam2[],exam3[])
{
int above90=0, above80=0, above70=0, above60=0;
if((num<=90) && (num >=100))
{
above90++;
{
if((num<=80) && (num >=89))
{
above80++;
{
if((num<=70) && (num >=79))
{
above70++;
{
if((num<=60) && (num >=69))
{
above60++;
}
}
}
}
}
}
}
}