ARRAYS

May 14, 2020 at 9:13pm
.
Last edited on May 16, 2020 at 3:47am
May 15, 2020 at 3:28am
Please edit your post for readability.
https://www.cplusplus.com/articles/jEywvCM9/

And FYI, actual programming questions go in one of the other forums on this site.
The is the lounge - for whatever.
May 15, 2020 at 1:00pm
also, details are very helpful.
code is not running correctly could mean anything.
one thing that I see immediately is that you think the first array location is 1. It isnt, its 0.
an array [7] has valid locations 0,1,2,3,4,5,6 for a total of 7 values. you want for(x = 0; x < 7; x++) to go through it. This alone is breaking your code; whatever else may also be going on in there.

when you access array[7] at location [7] or [8] it often works (runs) but what happens is that you are reading or editing memory that belongs to something else, like another variable, and from there things just go wrong.

for (int k = 1; k < 8; k++)
{
for (int b = 1; b < 4; b++)
{
cout << setw(10) << fixed << setprecision(2) << week[k][b];
Last edited on May 15, 2020 at 1:07pm
Topic archived. No new replies allowed.