I need help with debugging, please.
“int main ( )
{
int data [] = { 33, 27, 7, 3, 9, 2, 5, 11, 23, 1, 16, 29, 8, 0}; int tmp;
for( int i = 0; i < data.length; i++) cout << data[i] << ” ”;
cout << endl;
for (int i = 0; i < data.length-1; i++)
for (int j = i+1; j < data.length; j++)
if (data[i] > data[j])
{
tmp = data[i];
data[i] = data[j];
data[j] = tmp; }
for( int i = 0; i < data.length; i++) cout << data[i] << ” ”;
cout << endl;
system (“pause”);
return 0;
}”
From the code given for this task above, use the debugging technique and answer these:
In line 7, what is the output when ’cout’ has been executed 7 times?
In line 17, what is a value of ’tmp’ when ’I’ is equal to 5 and ’j’ is equal to 8?
In line 19, what is a value of data[j], when it has been executed for 25 times?
Later tell where you put your breakpoints.
Hi there! Click one of our representatives below and we will get back to you as soon as possible.