#2D Arrays and Functions

1564 messages ยท Page 2 of 2 (latest)

civic sparrow
#

You just have to ensure that smol starts with a valid value

#

As in, smol cannot start with a value that is smaller than all the values it's going to be compared to

merry owl
#

so what if

#

smol was the first index

#

thats possible right

civic sparrow
#

if you mean the value of x[0][0], yes

merry owl
#

ye

#

i can try that

#

cause then

#

we have a number from the table

#

and in that row

#

its only gonna look for a number smaller

#

once i point the sign in the ohter direction of course

#

alright

#
double temp(int x[][7],int rows, int colms)
int max = 0;
int smol = x[0][0];
int rowAvg = 0;
  for(int i = 0;i < rows;i++)
    for(int j= 0;j < colms;j++)
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];```
#

so it should look at index 0

#

first number of the first row

#

and compare if the other numbers are smaller than it

#

and what numbers are smaller than it

#

should make smol that smol

#

other wrise if there are no other smol numnrs

#

it will be smol already

#

yeah that makes sense

civic sparrow
#

that's it.

merry owl
#

ok great

#

now for the avg

#

for i ma need a sum varible for that

civic sparrow
#

Wait

merry owl
#

hm?

civic sparrow
#

That actually won't do. lol

merry owl
#

oh ๐Ÿ’€

#

i think i also just realizded it might give me the sum of the whole table

#

if i do that

civic sparrow
#

You need to define smol so that it's always the smallest of the week, not of the entire table

merry owl
#

oh

civic sparrow
#

So how do you that?

merry owl
#

oh yeah thats also a problem i dind't think of lol

#

so it just has to go before collums

#

right

#

actually both of them do

#

wait no

#

r deals with all the rows

#

not again

#

i don't supose i can just write cout << endl

civic sparrow
#

nah

merry owl
#

figures

#

well from yesterday

#

of the other function

#

to make week print

#

like the way we wanted

#

it was before the last for loop

#
double temp(int x[][7],int rows, int colms)
int max = 0;
int smol = 0;
int rowAvg = 0;
  for(int i = 0;i < rows;i++)
  if(x[i][j] > max) max = x[i][j];
      if(x[i][j] > smol) smol = x[i][j];
    for(int j= 0;j < colms;j++)```
#

but uhm

#

this doesnt sound right

#

its also going through the rows

civic sparrow
#

it isnt.

#

Anyways, I need to rest now, I'm going to travel in like, 5 hours, screw me kekw

merry owl
#

Alright

civic sparrow
#

Probably only going to get back here in Sunday, if you need help till there, I can

merry owl
#

Alright Iโ€™ll try my best to figure it out

#

Have a safe flight then

#

thanks for the help so far

civic sparrow
#

You're welcome, good night o/

merry owl
#

night and ttyl

gentle bayBOT
#

@merry owl Has your question been resolved? If so, type !solved :)

oak shell
#

u still need help @merry owl

merry owl
#

ah ye I do

#

So far i'm on the fourth function

oak shell
#

alright can you tell me where you're at

merry owl
#

sure

oak shell
merry owl
#

okay so

#

thats the question

#

this is my code so far

#
#include <iostream>
#include <cstdlib>
using namespace std;

void tempData(int x[][7],int rows,int colms){
    for(int i = 0;i < rows;i++){
        for(int j = 0;j < colms;j++){
        x[i][j] = rand () % 90 + 10;
        }
    }
}

void tempDisplay(int x[][7], int rows,int colms){
    for(int i = 0; i < rows;i++){
        cout << "Week " << i + 1 << " : ";
        for(int j = 0;j < colms;j++){
        cout <<  x[i][j] << "  ";
        }
        cout << endl;
    }
}

string convertNum(int x){
string days[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday",}; 
if(x > 6 || x < 0) return "0";
return days[x];

}

double temp(int x[][7],int rows, int colms)
int max = 0;
int smol = x[0][0];
int rowAvg = 0;
  for(int i = 0;i < rows;i++)
    for(int j= 0;j < colms;j++)
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];

double avgTempWeek (){
    
}

int main()
{
    int arr [4][7];
    tempData(arr,4, 7);
    tempDisplay(arr,4,7);
    return 0;
}```
#

bruh that posted before the question ๐Ÿ’€

#

i'll just screenshot what im focusing at

oak shell
#

uhh which function is it?

merry owl
#

double tmep

#

oops

#
double temp(int x[][7],int rows, int colms)
int max = 0;
int smol = x[0][0];
int rowAvg = 0;
  for(int i = 0;i < rows;i++)
    for(int j= 0;j < colms;j++)
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];```
#

this one

oak shell
#

also for a quick suggestion, in the convertNum function, I would personally return something like "Error: incorrect input"

oak shell
merry owl
#

yeah

#

i guess the max one is then ๐Ÿค”

#

hm i thought they might have the same porblme

#

cause both are going through the entire array

#

and i need tome both to go through only one row

oak shell
#

you're setting smol to the first element of the first array in in x[][7]

merry owl
#

yup

oak shell
merry owl
#

and comparing that to the rest of the numbers

#

in the row

#

or at least i want to

oak shell
#

so the ifs are correct

merry owl
#

ye

oak shell
#

can you send a screenshot of all the instructions

merry owl
#

sure thing

oak shell
#

btw, you're going to want to use curly braces for the for loops and if

merry owl
#

of each row u mean?

oak shell
merry owl
#

to access all the rows

#

i'd have to use a vairble i believe

#

so maybe put i in there

oak shell
#

u alr have the smol variable tho

#

so use that dont make any new ones

merry owl
#

yeah

#

my smol vairble holds x[0][0]

#

first row and first number in the row

#

but i guess for this to work

#

like u said

#

i need all the rows

oak shell
#

lets change that to
x row and first number in row

merry owl
#

so x[i][0]?

oak shell
#

try

merry owl
#
double temp(int x[][7],int rows, int colms){
int max = 0;
int smol = x[i][0];
int rowAvg = 0;
  for(int i = 0;i < rows;i++){
    for(int j= 0;j < colms;j++){
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];
    }
  }
}
#

oh right curly brakcets

oak shell
#

not gonna compile btw

oak shell
merry owl
oak shell
merry owl
#

right so i hav to declare it

oak shell
#

its like reading a book left to right, top to bottom

merry owl
#

after the for loops

#

is what ur saying?

oak shell
#

you want the variable smol to equal the first element in each row

merry owl
#

ye

oak shell
#

do you think loops will be needed or no

merry owl
#

no

#

but i is only declared in those loops

#

unless i leave it blank but i doubt that would work

oak shell
#

since you want the first element of each row, you need a loop.

merry owl
#

wait another one?

#

hmm

oak shell
#

no

merry owl
#

aftet the two loops right

#

oh

oak shell
#

what would happen

merry owl
#

yeah no that owuldnt work

#

cause it would do the same thing as the ohter loops

merry owl
oak shell
# merry owl but then wdym by this
#include <iostream>
int main() {
  int x[3][3] = { {0, 4, 1}, {3, 1, 1}, {7, 9, 10} };
  int max = 0;
  int min = x[0][0];
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      if (x[i][j] > max) {
        max = x[i][j];
      }
      if (x[i][j] < min) {
        min = x[i][j];
      }
      std::cout << "min: " << min << "   " << "max: " << max << "   ";
    }
  std::cout << "\n";
  }
}
merry owl
#

oh i get it, u did it after the inner for loop

#

the if statement

oak shell
#

well i have it the same as yours

#

right now

#

it's incorrect

#

do you see the output of min

brisk portalBOT
#
Program Output
min: 0   max: 0   min: 0   max: 4   min: 0   max: 4   
min: 0   max: 4   min: 0   max: 4   min: 0   max: 4   
min: 0   max: 7   min: 0   max: 9   min: 0   max: 10
merry owl
#

oh ye

#

its not right

oak shell
#

so why's it like that

merry owl
#

u wrote it in the mian fuction too

#

but probably a small diference

#

i mean after the inner for loop

oak shell
merry owl
#

its not counting the collums for the min right

#

thats my guess

oak shell
merry owl
#

u need both so that smol can go through the collums

#

not count what i mean is

#

go throuh the collums

#

each collums in one row

#

goes throuhg it

#

but it can't do that if its outside the inner loop

#

but the for loop goes throughthe enturre array

oak shell
#

i think its supposed to set min to the first column in each row?

#

do you agree

merry owl
#

ye

oak shell
#

this is the 2d array for example

  int x[3][3] = { {0, 4, 1}, {3, 1, 1}, {7, 9, 10} };
merry owl
#

right

oak shell
#

what are the smallest numbers in each row

merry owl
#

the min is 0 for the first row

#

1 for the second

#

7 for the third

oak shell
#

ye so if we set it to x[0][0] at the beginning and check thru the whole array it will be checking against 0

#

so we gotta find a way to set it to the first number of each row

merry owl
#

oh yeah never though about if the min was zero

oak shell
#

so that it sets it to 0 for the first row, then 3 the second, then 7 for the third

merry owl
#

hmm

#
if (x[i][j] < min) {
        min = x[i][j];
      }```
#

this part

#

the porblem rn

#

is what min is holding yes?

oak shell
#

in your code its the first temperature of the entire array

merry owl
#

though if we don't want it to go past zero

#

can't we do less than or equal to?

oak shell
#

i mean it shouldn't matter

merry owl
#

ah okay

#

lets see in my code

#
double temp(int x[][7],int rows, int colms){
int max = 0;
int smol = x[i][0];
int rowAvg = 0;
  for(int i = 0;i < rows;i++){
    for(int j= 0;j < colms;j++){
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];
    }
  }
}```
oak shell
#

incorrect part is the smol initialization

merry owl
#

i'll just use these numbers for reference

oak shell
#

okk

#

cool

#

for week 2, we need to set it to the first element; 32

#

and week 3; 61

#

etc

merry owl
oak shell
#

is there a pattern to this

merry owl
#

to unlock a spcific row

#

i need a speicific index

oak shell
#

this is true

merry owl
#

to be able unclock each row..

#

i thought that would be the same thing as unlokcing every row

oak shell
#

what variable should you use

oak shell
#

in this case

merry owl
#

like all the rows

#

what vairble u say

#

u don't mean the second box do u?

oak shell
#

what box

#

like x[][]

merry owl
#

the array i mean

#

ye

#

x[][]

#

rn i have x[i][0]

#

and that i thought would give me the first number of each row

oak shell
merry owl
#

like where i is intionalized right

#

rn the for loop is where its intilatzied

oak shell
#

ok

merry owl
#

or maybe u mean after the first loop

#

where i is instiizled thats where it should go

#

but then what about the collums

oak shell
#

what about it

merry owl
#

wait actaully

#

the 0

#

already tells me

#

what place int he collums

#

so maybe its possibke

#

so rn now this is what i think your telling me to do

#
double temp(int x[][7],int rows, int colms){
int max = 0;
int rowAvg = 0;
  for(int i = 0;i < rows;i++){
  int smol = x[i][0];
    for(int j= 0;j < colms;j++){
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];
    }
  }
}```
oak shell
#

why did u move the if

merry owl
#

but tis wrong right

oak shell
#

it was fine down there

merry owl
#

yes i misinterpretted then

oak shell
merry owl
#

oh wait the vairble

#

not the if

#

i just put the wrong one there

#

like that?

#

i edited it

oak shell
#

uhh i think that might work

merry owl
#

ye

oak shell
#
double temp(int x[][7],int rows, int colms){
int max = 0;
int smol;
int rowAvg = 0;
  for(int i = 0;i < rows;i++){
   smol = x[i][0];
    for(int j= 0;j < colms;j++){
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];
    }
  }
}
#

i would do this personally in case i wanna use smol later

#

nah it shouldnt matter to muc tho

merry owl
#

alright

#

but ye that means now both the max and smol funtion should work

#

oh wait i do need to print it out like this when i call this function

#

so i guess i have to put some cout here

#

or i could do it in the main function

#

wait no its repaeating

#

so might have to afterall

#

wait i should porbably deal with the avergaeg first lol

#

before i worry about pritning

#

ok so

#
double temp(int x[][7],int rows, int colms){
int max = 0;
double rowAvg = 0.0;
int sum = 0;
  for(int i = 0;i < rows;i++){
  int smol = x[i][0];
    for(int j= 0;j < colms;j++){
      sum += x[i][j];
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];
    }
  }
double rowAvg = sum/colms;
}```
#

dis the code so far

#

now i need to get the avg

#

of each row

#

so that should be adding the sum of each row

#

and diviing by the amount of collums

#

i need a sum vairble thouhg

#

okay not to figure out how to only add each row

#

and not the whole thing

oak shell
#

ok ima let u try to figure it out

#

lmk if ur stumped

merry owl
#

ok i think that has to be after both after all

#

cause it needs to account for collums

#

so a simple sum =+ x[i][j] hopefully

#

and then average

#

so i think that needs to be outside

#

the for loop

#

alright thats what i have

#

somethign seems off though

#

if the sum varible is inside the for loop

#

is it gonna hold even after?

#

well it should

#

its a varible

#

and its in the function

#

but everything closes after a for loop

#

what do u think

oak shell
#

whats the question

merry owl
#

what are ur thoughts on the sum and avg part

#
double temp(int x[][7],int rows, int colms){
int max = 0;
double rowAvg = 0.0;
int sum = 0;
  for(int i = 0;i < rows;i++){
  int smol = x[i][0];
    for(int j= 0;j < colms;j++){
      sum += x[i][j];
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];
    }
  }
double rowAvg = sum/colms;
}```
#

thought i only want the sum of each row

merry owl
#

ye thats what it said

solid flower
#

U just gotta delete the double keyword

#

In row 42

merry owl
#

oh lol right its a varible

#

oh Snow

#

hi

merry owl
#

i can just write this right

#
 cout << temp(arr,4,7);```
#

than again

#

the purpose of this function is to get the high and low and avg

#

those numbers should porbably be a specific row

oak shell
#

oh the function

merry owl
#

double

oak shell
#

try it

merry owl
#

ye

#

whatever the heck that is

#

u know maybe i did something wrong in my main fucntion

oak shell
#

can you guess why it may do that

merry owl
#

ah okay

merry owl
#

somehow

oak shell
#

what are you trying to cout

merry owl
#

the function temp

#

which is supose to give me three things

oak shell
#

so it has to return something

#

right

merry owl
#

ye

oak shell
#

what does it return

#

show

merry owl
#

oh right im not returning anything

#

i need to return three things

oak shell
#

you cannot

merry owl
#

okay so

#
double temp(int x[][7],int rows, int colms){
int max = 0;
double rowAvg = 0.0;
int sum = 0;
  for(int i = 0;i < rows;i++){
  int smol = x[i][0];
    for(int j= 0;j < colms;j++){
      sum += x[i][j];
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];
    }
  }
 rowAvg = sum/colms;
}```
merry owl
#

how come

oak shell
#

how would u

merry owl
#

oh wait it only return one thing

#

with those if statments

#

but then how would i get three things out of this funciton

#

cout?

#

perhaps

#

after the second for loop

#

i could go cout

#

and then max, min and rowavg

#

but that reminds me

#

its not like its a void function

#

so it does have to return something

#

whatever that may be but ad for the other things, would just cout them work?

solid flower
merry owl
#

ye since it was thankgiving week, i got some relaxing going on

#

but now i'm back to work lol

solid flower
#

Ah working on 2D arrays, that took me longer than it shouldโ€™ve to understand lol

merry owl
#

lol ye

#

to catch u up

#

thats the quesiton

#

if it would show up fastee

#

and thats my code so far

#
#include <iostream>
#include <cstdlib>
using namespace std;

void tempData(int x[][7],int rows,int colms){
    for(int i = 0;i < rows;i++){
        for(int j = 0;j < colms;j++){
        x[i][j] = rand () % 90 + 10;
        }
    }
}

void tempDisplay(int x[][7], int rows,int colms){
    for(int i = 0; i < rows;i++){
        cout << "Week " << i + 1 << " : ";
        for(int j = 0;j < colms;j++){
        cout <<  x[i][j] << "  ";
        }
        cout << endl;
    }
}

string convertNum(int x){
string days[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday",}; 
if(x > 6 || x < 0) return "0";
return days[x];

}

double temp(int x[][7],int rows, int colms){
int max = 0;
double rowAvg = 0.0;
int sum = 0;
  for(int i = 0;i < rows;i++){
  int smol = x[i][0];
    for(int j= 0;j < colms;j++){
      sum += x[i][j];
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];
    }
  }
 rowAvg = sum/colms;
}

double avgTempWeek (){
    
}

int main()
{
    int arr [4][7];
    tempData(arr,4, 7);
    tempDisplay(arr,4,7);
    cout << temp(arr,4,7);
    return 0;
}```
#

rn i'm wokring on the fourth function

#

double temp

#
double temp(int x[][7],int rows, int colms){
int max = 0;
double rowAvg = 0.0;
int sum = 0;
  for(int i = 0;i < rows;i++){
  int smol = x[i][0];
    for(int j= 0;j < colms;j++){
      sum += x[i][j];
      if(x[i][j] > max) max = x[i][j];
      if(x[i][j] < smol) smol = x[i][j];
      cout << "Highest Temperature:" << max << endl;
      cout << "Lowest Temperature: " << smol << endl;
    }
  }
 rowAvg = sum/colms;
cout << "Average Temperature: " << rowAvg << endl;
}```
#

and thats what i have

solid flower
#

Ah okay I get the instructions

#

Codeโ€™s gonna take me a bit to read BC Iโ€™m slow at reading code

merry owl
#

ye lol take ur time

#

right so @oak shell would it work if i just cout the max , min and avg?

#

though i kinda need that happening mutiple time so it would have to be in the loop

oak shell
#

try it

#

u dont have to ask me

merry owl
#

okay

#

ah well its a start...

#

i supose

oak shell
#

nice

#

im assuming it works

merry owl
#

hold one lemme send better pics

#

how is that much for just four rows

oak shell
#

4*7 prob

merry owl
#

oh

#

so i can't use those number in the mian

#

seven porbably has to stay

#

since its the collum box

#

oh wait i put 1

#

and got these

#

those amount looks more resoable now

#

well more or less

#

only one avg

#

ok maybe the collums do need to chnage

#

no that wouldnt make sense

oak shell
merry owl
#

well i mean i want it to go throuhg 4 rows and 7 collums

#

its giving me so many numbers when its supose to gime me 3 numbers from one row

#

still no clue why this shows up either

merry owl
#

i can have different numbers in there

oak shell
merry owl
#

but i wanna know why

#

from what i can tell

#

this fourht function is supose to go throuhg given rows and collums

#

and grab 3 numbers from there

#

does the rows and collmus varible in the parameters determine how much of the orw and collum it can go to?

merry owl
#

also i dont thhink its doing th ecalculaiton right either

oak shell
merry owl
#

idont know what other high and low numbers they are getting

#

but its scarmbled

#

first row

#

high number is right

#

though the second line for low temp is 83 which isnt true

#

but at the same time i dont think that line is that row

#

it seems scattered

#

but the 4th line

#

26

#

thats the smallest value in row 0

#

wait its also

#

printing the same numbers ๐Ÿ’€

#

i just noticied

#

well more or less

#

actaully lemme try put 1 and 7

#

putting 1 and 7

#

it should only touch the first row

#

and give three numbers

#

but it gives 15 things

#

I guess that means i messed up somewhere with theorder of the cout

#

for sure

#

I'm gonna try to figure this out all tomrorow

#

I think i'm just gonan go to sleep for now

#

my brain is too fried rn lol

#

goodnight everyone

#

thank u all for helping

#

ttyl

solid flower
#

Idk but the last output looks like a trash value, meaning ur accessing past an array or didnโ€™t write to the last element in an array

#

Okay same goodnight

merry owl
#

ye night

gentle bayBOT
#

@merry owl Has your question been resolved? If so, type !solved :)

merry owl
#

ok i chnaged some things but i got it to work

#
void temp(int x[][7],int rows, int colms){
double rowAvg = 0.0;
  for(int i = 0;i < rows;i++){
  int smol = 0;
  int max = 0;
  int sum = 0;
    for(int j= 0;j < colms;j++){
     sum += x[i][j];
        if(x[i][j] > x[i][max]) max = j;
        if(x[i][j] < x[i][smol]) smol = j;
     }
    cout <<" -- " << "Week " << i + 1 << " -- " << endl;
    cout << "Highest Temperature: " << x[i][max] << "(" << convertNum(max) << ")" << endl;  
    cout << "Lowest Temperature: " << x[i][smol] << "(" << convertNum(smol) << ")" << endl;
    rowAvg = sum/7.0;
    cout << "Average Temperature: " << rowAvg << endl;
  }
}```
oak shell
#

W

merry owl
#

ye

#

i did the last one too

#
void avgTempWeek (int x[][7],int rows,int colms){
double colmAvg = 0.0;
    for(int j = 0;j < colms;j++){
    int sum = 0;
        for(int i= 0;i < rows;i++){
                 sum += x[i][j];
        }
        colmAvg = sum/4.0;
        cout << "--" << "Average by Weekday " << "--" << endl;
        cout << convertNum(j - 1 + 1) << ":" << colmAvg << endl;
    }
}```
#

it seems to work

#

but i'm wondering if i'm missing anything cause i can be blind

#

but it prints out this

#

so yeah it looks like there isn't any thing that shouldn;t be there

oak shell
merry owl
#

oh wait that first line isn't supose to print mutiple times

oak shell
merry owl
#

okay lets see

#
void avgTempWeek (int x[][7],int rows,int colms){
double colmAvg = 0.0;
    for(int j = 0;j < colms;j++){
    int sum = 0;
    cout << "--" << "Average by Weekday " << "--" << endl;
        for(int i= 0;i < rows;i++){
                 sum += x[i][j];
        }
        colmAvg = sum/4.0;
        cout << convertNum(j - 1 + 1) << ":" << colmAvg << endl;
    }
}```
#

so maybe it goes inside the inner for loop

#

no lol it prints it four times ๐Ÿ˜…

#

so i guess after the first for loop maybe

#

got it

#

so above both for loops

#

which makes sense

#

dont want it to repeat

oak shell
#

are the values supposed to be different

#

also... lmfao

merry owl
#

ye

#

but it works lol

#

somehow

#

oh right i should probably show the whole code

oak shell
#

whats the point in subtracting by one then adding by one

merry owl
#

well my intention at first was to keep make it go through the collums

#

with the plus 1

#

but then the index started with 1

#

with the j

#

and i need 0

#

so thats why lol

#

here is the whole code btw

#
#include <iostream>
#include <cstdlib>
using namespace std;

void tempData(int x[][7],int rows,int colms){
    for(int i = 0;i < rows;i++){
        for(int j = 0;j < colms;j++){
        x[i][j] = rand () % 90 + 10;
        }
    }
}

void tempDisplay(int x[][7], int rows,int colms){
    for(int i = 0; i < rows;i++){
        cout << "Week " << i + 1 << " : ";
        for(int j = 0;j < colms;j++){
        cout <<  x[i][j] << "  ";
        }
        cout << endl;
    }
}

string convertNum(int x){
string days[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday",}; 
if(x > 6 || x < 0) return "0";
return days[x];

}

void temp(int x[][7],int rows, int colms){
double rowAvg = 0.0;
  for(int i = 0;i < rows;i++){
  int smol = 0;
  int max = 0;
  int sum = 0;
    for(int j= 0;j < colms;j++){
     sum += x[i][j];
        if(x[i][j] > x[i][max]) max = j;
        if(x[i][j] < x[i][smol]) smol = j;
     }
    cout <<" -- " << "Week " << i + 1 << " -- " << endl;
    cout << "Highest Temperature: " << x[i][max] << "(" << convertNum(max) << ")" << endl;  
    cout << "Lowest Temperature: " << x[i][smol] << "(" << convertNum(smol) << ")" << endl;
    rowAvg = sum/7.0;
    cout << "Average Temperature: " << rowAvg << endl;
  }
}

void avgTempWeek (int x[][7],int rows,int colms){
double colmAvg = 0.0;
    cout << "--" << "Average by Weekday " << "--" << endl;
    for(int j = 0;j < colms;j++){
    int sum = 0;
        for(int i= 0;i < rows;i++){
                 sum += x[i][j];
        }
        colmAvg = sum/4.0;
        cout << convertNum(j - 1 + 1) << ":" << colmAvg << endl;
    }
}

int main()
{
    int arr [4][7];
    tempData(arr,4, 7);
    tempDisplay(arr,4,7);
    temp(arr,4,7);
    avgTempWeek(arr,4,7);
    return 0;
}```
oak shell
#

what's the difference between convertNum(j - 1 + 1) and convertNum(j)?

merry owl
#

hmm lets see

#

appaerntly none ๐Ÿ’€

oak shell
#

why lol

merry owl
#

yes lol

#

cause everything feels unpredictable

#

sometimes

#

okay i guess i can just leave the j there lol

oak shell
#

is it supposed to be the same

merry owl
#

oh no its supose to be different

#

its randomized

oak shell
#

ah ok

merry owl
#

but ye i think i've covered anything

#

i don't i'm missing anythign else

#

lemme me know if u notice anything though lol cause i can be blind

#

but ye i guess this means i'm done with it

oak shell
#

show the whole output

merry owl
#

ye

oak shell
#

the spacing is a bit different, fix that and i think youre good to go

merry owl
#

ye i'll do it by like one spot or something

#

i just thats just cout uh space

#

in the main function

#

okay seems like it matches now

oak shell
#

Missing the first line

merry owl
#

ih yeah

#

oh yeah i have that nowhere written thats weird

#

but i guess thats the second function

#

okay there

oak shell
#

ur missing a space between the days: num

merry owl
#

oh alright

oak shell
#

Also here

merry owl
oak shell
merry owl
#

well its randomized

oak shell
#

space on the left probably

merry owl
#

so i think its supose to do that

#

since its idfferent numbers

oak shell
#

between the num and the open parenthesis

merry owl
#

oh okay

oak shell
#

also it should be 3 dashes, like so: --- you have 2

merry owl
#

ye

oak shell
merry owl
#

oh okay that one

oak shell
#

also no space on the left

merry owl
#

the other ones stay two

oak shell
merry owl
#

or they should be three as well?

#

ok got it

oak shell
#

i can't really see the picture but you have it

merry owl
oak shell
#

nice! i think everythings sorted

merry owl
#

great

#

I'm finnaly done

#

aftet two days

#

oh wait no 2 days and a half

#

but yee i'm doneee

#

oh ye also thank you for ur help

#

could not have gotten this far without you all

#

I'll close the post then

oak shell
#

okok

#

gl and thx

merry owl
#

Have a nice day yee

gentle bayBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

civic sparrow
#

Very good, congrats @merry owl

#

And I also appreciate the efforts of everyone else helping here ๐Ÿ‘