What will be printed out as a result of the following program's execution:

#include <iostream>

using namespace std;

void f(int n, bool skip) {
    switch (n) {
       case 1: cout << 1;

       if (!skip)
       case 2: cout << 2;

       if (!skip)
       default: cout << n;
    }
}

int main()
{
    f(1, true);
    f(2, false);
    return 0;
}

@tradingstata05 can you point what is bad exactly? Then we will be able to fix it. Thanks

2017 Dec 4, 10:19:25 AM

Bad question

2017 Nov 19, 2:12:25 PM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback