how to pass an array into an function and in the function count how many numbers are in a range?

Posted by user320950 on Stack Overflow See other posts from Stack Overflow or by user320950
Published on 2010-04-24T21:21:02Z Indexed on 2010/04/24 21:23 UTC
Read the original article Hit count: 265

Filed under:
|
|
|
|
    #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++;
           }
          }
         }
        }
       }
      }
     }
    }

© Stack Overflow or respective owner

Related posts about add

Related posts about total