Problem With Arrays

Help i am having an issue with the output of my program. I am filling a 2-D array with random numbers to represent the temperature for every hour for every day of the week. When i call a function to calculate the average of a certain day it gives me the wrong answer. You will see in my code below i am just wanting to view the average for [0] only for debugging purposes. Any help would be appreciated.
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
using namespace std;
void dayAvg(int randomTemp[][24], int rows, int col){
int dayAvgArr[7], day;
cout<<"Please Enter A Day(1-7): ";
cin>>day;
for(int i=0;i<rows;i++){
dayAvgArr[i]=0;
for(int j=0;j<col;j++){
dayAvgArr[i]+=randomTemp[i][j];
dayAvgArr[i]/=24;
}
}
cout<<"Day "<<day<<"\'s Average Temperature Is: "<<dayAvgArr[0]<<endl;
}
int main(){
int temp[7][24];
int row=7, column=24;
srand(time(NULL));
for(int i=0;i<row;i++){
for(int j=0;j<column;j++){
temp[i][j]=rand()%121;
}
}
dayAvg(temp,row,column);
//Displays the array for debbuging purposes
for(int i=0;i<row;i++){
for(int j=0;j<column;j++){
cout<<temp[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
1
2
3
4
for(int j=0;j<col;j++){
  dayAvgArr[i]+=randomTemp[i][j];
  dayAvgArr[i]/=24; // take this out of the loop.
}
Thank you ever so much. It seems that its always something small you miss in this language i appreciate it. Cheers.
Topic archived. No new replies allowed.