Question: Please explain why the outputs are what they are in visual studio. New to C++ so please explain as best and simply as you can.
Please explain why the outputs are what they are in visual studio. New to C++ so please explain as best and simply as you can. Thank you! 1. for (i = 1 ; i <= 10 ; i++) { if (i == 2) cout << "hello" << endl; else if (i == 3) cout << "goodbye" << endl; else if (i == 4) cout << "why" << endl; if (i < 5) cout << "help" << endl; if (i > 6) cout << "blue" << endl; } 2. w = 0; for (h = -2; h <= 5; ++h) w = w + h; cout << w; 3. w = 0; for (h = 10; h > 0; --h) cout << w; 4. n = 1; for (k = 2; k <= 5; k++) { n = k - 2 * 3; cout << k << ' ' << n << endl; } 5. for (x = 1; x <= 5; x++) cout << x << endl; cout << x << endl; 6. for (int i = 0; i < 5; i++) { switch (i) { case 0: cout<< i<= 4; d--) for (int e = 2; e <= 4; e++) cout << d << ' ' << e << endl; 11. for (i = 1 ; i <= 5 ; i++) { cout << i << endl; for (j = i ; j >= 1 ; j -= 2) cout << j << endl; } 12. for (i = 1 ; i <= 3 ; i++) for (j = 1 ; j <= 3 ; j++) { for (k = i ; k <= j ; k++) cout << i << j << k << endl; cout << endl; } 13. for (i = 3 ; i > 0 ; i--) for (j = 1 ; j <= i ; j++) for (k = i ; k >= j ; k--) cout << i << j << k << endl;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
