Array help needed

Program #4
Write a program that reads grades from the keyboard into an array. The program should read up to fifty grades or stop asking when the user enters a negative value. After all grades have been input, the program should display the total number of grades along with the average, and the grades should be listed with an asterisk (*) indicating each grade that is below the average.

Submit:

Pseudocode
Thoroughly documented program
So what is your question ?
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "you.hpp"
#include "book.hpp"

int main() {
  You you;
  Book book;

  you.read(book);
  you.pay_attention_in_class();
  you.write_program();

  return 0;
}


You're welcome good sir!
I have a problem with where the ** are, its giving me No matching function

#include <iostream>
using namespace std;

// declare variables
float Average_Grades, Total_Grades, Number;
//program should accept 50grades
void inputArray(float(), int);
int main(){
int const INPUT_GRADES = 50;
float Grades[INPUT_GRADES];
//accept input from user
do {

cout << "Enter first array numbers..." << endl;
** inputArray(Grades, INPUT_GRADES);
cout << endl;
// calculate the total number of results

// display results
// calculate average
// display average
// grades below average should have an asterick
//program should end when there is a negative number
}while ( Number >= 0);

return 0 ;
}
void inputArray (float INPUT_GRADES, float i, float Grades[]){

for (int i = 0 ;i < INPUT_GRADES; i ++){
cout << " Enter The First 50 Grades :" << endl;
cin >> Grades[i];
}
}
Declare float i locally inside void, match the order of your variable and type with the function declaration, call, and function itself.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>

using namespace std;

// Declare variables
float Average_Grades, Total_Grades, Number;
// Program should accept 50 grades

void inputArray(int, float []);

int main()
{
const int INPUT_GRADES = 50;

float Grades[INPUT_GRADES];
//Accept input from user
do {

cout << "Enter first array numbers..." << endl;
inputArray(INPUT_GRADES, Grades);
cout << endl;
// Calculate the total number of results
// Display results
// Calculate average
// Display average
// Grades below average should have an asterisk
// Program should end when there is a negative number
}while ( Number >= 0); 

return 0;
}
void inputArray (int INPUT_GRADES, float Grades[])
{
float i;

for (int i = 0 ;i < INPUT_GRADES; i ++)
{
cout << " Enter The First 50 Grades :" << endl;
cin >> Grades[i];
}
}


If your still having problems, look in a book regarding function declarations, calling statements, and writing functions.
Last edited on
Topic archived. No new replies allowed.