Question: Consider the following c++ function: Void strange (int stuff [6]) Int leaf, rake; Rake =10; For ( leaf = 0 ; leaf < 4; leaf++)
Consider the following c++ function:
Void strange (int stuff [6])
Int leaf, rake;
Rake =10;
For ( leaf = 0 ; leaf < 4; leaf++)
Stuff [leaf] = rake;
Rake = rake 2;
}
Stuff [4] = Stuff [0] + Stuff [1] ;
Stuff [5] = Stuff [2] + Stuff [4] ;
For ( leaf = 0; leaf < 6 ; leaf = leaf + 2)
Stuff [leaf]--; }
Show the value that will be stored in the array stuff as the function runs. If a number in the array changes, cross out the old number with a single line:
[0] [1] [2] [3] [4] [5]
2)Write function definitioon called same_row that takes a 100 by 100 two dimensional integer array as its only parameter. It sets the elements ineach row of the array equal to the first in the row. Same_row dose not return a value.
For Example:
| 6 | 12 | 13 | 1 | 22 | 74 | 19 | 16 | 1 |
| 33 | 14 | 99 | 18 | 44 | 12 | 45 | 43 | 11 |
Would become:
| 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 |
| 33 | 33 | 33 | 33 | 33 | 33 | 33 | 33 | 33 |
3a) Write function definitioon called equal_arround that takes a 100 element character arrayand an integer index as its parameters. It returns aboolean value. equal_arround returns true if the element in the array at the given index is equal to at least one of the two elements next to it. Else, it returns false. It should not check elements outside the array bounds.
For example
| .. | x | b | Y |
[index]
Would returns false (b at the given inde is not equal to x or y)
And as another example:
| .. | T | R | R |
[index]
Would returns TRUE (R at the given inde is equal to the elements next to it, R!)
3b) show a function call to your function equal_arround in the Boolean epression for the following if statement that will be true if the element at index 5 in the 100 element character arraysentence is equal to either of the elements next to it .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
