i have this code and for an class work task and you have to do a walkthrough table and work out the output. But i dont know how you do a walkthrough table. Can someone help?

int c = 0, sum = 0;
while (sum < 8)
{
c++;
sum += c;
}
cout << sum;

Can you give a specific example of the task or better explain the problem narratively?

The word table when used in the context of C++ frequently refers to a 2 dimensional array of values and your code implements an algorhithm to accumulate value in variable called sum by adding the value of c to sum each time through the loop, so I suspect you might want to be writing code to walk through a table of values adding the value of each item in the table to generate a total value of all elements in the table. But then again I could be way of base, too.

Can you give a specific example of the task or better explain the problem narratively?

The word table when used in the context of C++ frequently refers to a 2 dimensional array of values and your code implements an algorhithm to accumulate value in variable called sum by adding the value of c to sum each time through the loop, so I suspect you might want to be writing code to walk through a table of values adding the value of each item in the table to generate a total value of all elements in the table. But then again I could be way of base, too.

This is how the question was given and next to it was a table with 3 columns and some amount of rows and i know your ment to go through each step that it would take to work out the final value.

Q1. Given the code below:-

int c = 0, sum = 0;
while (sum < 8)
{
c++;
sum += c;
}
cout << sum;

Well without the table to look at it's hard to say what the values in it are. It might have been something like a table that represented the value of c and sum each time through the loop, but who knows.
# c sum
1 1 1
2 2 3

What its asking you is to make a walk through table -- a step by step table
where each row corresponds to each iteration of the loop. Here, I'll get you started

Given this code :

int c = 0, sum = 0;
while (sum < 8) {
c++;
sum += c;
}
cout << sum;

a walk through table might look like this to start :

iteration # , value of c , value of sum
---------------------------------------
0 0 0
1 1 1
2 2 3
3 3 6
. . .
. . .
. . .