c ++ que pasa matrices 2d a funciones
Sé que mi código aún no está terminado, no estoy pidiendo que se haga. Se supone que ingresa alimentos consumidos por 3 monos durante una semana y otras cosas. Pero he acertado un obstáculo. Me da un error (Error: ningún operador "<<" coincide con estos operandos) cuando pongo el cin en la función contrabajas. ¿No estoy pasando la matriz correctamente? ¿Por qué no funciona? Gracias por cualquier ayuda
#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
}
}
}