私は自分のコードが完成していないことを知っていますが、それを行うように求めていません。3 匹のサルが 1 週間で食べたエサなどを入力することになっています。しかし、私は思わぬ障害にぶつかりました。cinをlbsEaten関数に入れると、エラーが発生します(エラー:これらのオペランドに一致する演算子「<<」はありません)。配列を正しく渡していないので、機能していませんか? 助けてくれてありがとう
#include <iomanip>
#include <iostream>
using namespace std;
//Global Constants
const int NUM_MONKEYS = 3;
const int DAYS = 7;
//Prototypes
void poundsEaten(const double[][DAYS],int, int);
void averageEaten();
void least();
void most();
int main()
{
//const int NUM_MONKEYS = 3;
//const int DAYS = 7;
double foodEaten[NUM_MONKEYS][DAYS]; //Array with 3 rows, 7 columns
poundsEaten(foodEaten, NUM_MONKEYS, DAYS);
system("pause");
return 0;
}
void poundsEaten(const double array[][DAYS], int rows, int cols)
{
for(int index = 0; index < rows; index++)
{
for(int count = 0; count < DAYS; count++)
{
cout << "Pounds of food eaten on day " << (index + 1);
cout << " by monkey " << (count + 1);
cin >> array[index][count];
// Here is where i get the error
}
}
}