Please answer number 4 4 For the following program segment f

Please answer number 4.

4. For the following program segment, fill in the tracing table below as described in the course notes. You should make a duplicate of this table in your homework submission. 1 String str Hello World 2 int test. 6 3 String output 4 if test str. length output Bigger 7 else output Smaller Program State Statement String str \"Hello World int test. String output str test output if test str length str test output output \"Bigger

Solution

int main()
{
string str = \"Hello World!\";
int test = 6;
string output = \"\";

/*
Str = Hello World!
test = 6
output = \"\"
*/

// since test is less that str.length(), this block does not gets executed
if(test > str.length())
{
output = \"Bigger!\";

}
else
{
/*
Str = Hello World!
test = 6
output = \"\"
*/

output = \"Smaler!\";
/*
Str = Hello World!
test = 6
output = Smaler!
*/

}

/*
Str = Hello World!
test = 6
output = Smaler!
*/

return 0;
}

Please answer number 4. 4. For the following program segment, fill in the tracing table below as described in the course notes. You should make a duplicate of t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site