Advertisement

03.04.2008 at 10:54PM PST, ID: 23215146
[x]
Attachment Details

Calculating class grade average using arrays

Asked by amlegacy in C Programming Language

HI,

I'm trying to create an array to calculate the class grade average. I only want to return the answer for grades[4]. I haven't been shown how to pass one element.

#include <iostream>

void my_average (double score [], int elements);

int main (void)

{

      double ans [5] = {0};
      my_average (ans, 5);


      return 0;
}

void my_average (double score [], int elements)

{

      double  grades [5];

      grades[0] = 88;
      grades[1] = 65;
      grades[2] = 99;
      grades[3] = 110;
      grades[4] = ((grades[0] + grades[1] + grades[2] + grades[3])/400); //calculates the average
}Start Free Trial
[+][-]03.04.2008 at 10:57PM PST, ID: 21048285

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 10:58PM PST, ID: 21048288

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 11:00PM PST, ID: 21048298

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C Programming Language
Sign Up Now!
Solution Provided By: Infinity08
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.04.2008 at 11:02PM PST, ID: 21048301

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 11:08PM PST, ID: 21048325

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 11:11PM PST, ID: 21048339

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 11:12PM PST, ID: 21048345

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 11:12PM PST, ID: 21048348

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628