What is the output of the following code? Assume all other necessary and relevan
ID: 3824199 • Letter: W
Question
What is the output of the following code? Assume all other necessary and relevant C++ code is present in the program, it’s just not shown below. Add a comment to every line of code. Hint: make a table of values for jack.
need some help please!
void someFunction( const array< int, 5 > &a, int b );
int main() {
array< int, 5 > jack;
for( int x = 0; x < jack.size(); x++ ){
jack[ x ] = 100 / (x+1);
}
someFunction( jack, 0 );
return 0; }
void someFunction( const array< int, 5 > &a, int current ) {
if( b < a.size() ){
cout << a[ current ] << “ “;
} }
someFunction( a, current+1 );
Explanation / Answer
1. Initally Jack is filled with 100, 50, 33, 25, 20
2. someFunction is called with Jack and 0
3. Then someFunction will iterate over Jack and Print the contents
100 50 33 25 20
4. It will return to main
thanks, let me know if there is any concern.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.