c++ - Why am i getting this compile error when i try to compile? -


i some-what new programming in c++ assigned exercise i'm getting compile error

i hoping can either me resolve error or give me insight why happening code below /* exercise 21 intermediate: declare seven-row, two- column int array named temperatures. program should prompt user enter highest , lowest temperatures 7 days. store highest temperatures in first column in array. store lowest temperatures in second column. program should display average high temperature , average low temperature. display average temperatures 1 decimal place. */

#include <iostream> #include <iomanip> using namespace std;  //function prototype void calcaverage(double temperatures[7][2]);  main() { double temperatures[7][2] = {0};  float high = 0.0; float low = 0.0; double high_average = 0.0; double low_average = 0.0;    cout << "please enter high low last 7 days " <<endl;  for(int x = 0; x < 6; x += 1) {     cout << "please enter high day: "<< x+1<<": ";     cin >> high;     temperatures[0][x] = high; } for(int x = 0; x < 6; x += 1) {     cout << "please enter low day: "<< x+1<<": ";     cin >> low;     temperatures[1][x] = high; } //error here calcaverage(high_average, low_average); // end error    system("pause");         }   void calcaverage(double temperatures[6][1],double &high_average, double &low_average) { float accumulator = 0.0; //for hot average   for(int x = 0; x < 6; x += 1) {     accumulator += temperatures[0][x]; }     high_average = accumulator;  // cold average      accumulator = 0.0; for(int x = 0; x < 6; x += 1) {     accumulator += temperatures[1][x]; }     low_average = accumulator; } 

44 cannot convert double' todouble ()[2]' argument 1' tovoid calcaverage(double ()[2])'

void calcaverage(double temperatures[7][2]); 

okay, calcaverage takes two-dimensional array of doubles.

calcaverage(high_average, low_average); 

but passed 2 doubles.

void calcaverage(double temperatures[6][1],double &high_average, double &low_average) 

and takes two-dimensional array of doubles , 2 references.

pick 1 of these 3 , stick it.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -