Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (anonymous):

please how i can slove it ? Rewrite the following fragment using switch: if (ch == 'A') a_grade++; else if (ch == 'B') b_grade++; else if (ch == 'C') c_grade++; else if (ch == 'D') d_grade++; else f_grade++;

OpenStudy (anonymous):

do you know what switch is?

OpenStudy (anonymous):

it's a selection struture in c++

OpenStudy (anonymous):

switch(ch){ case: 'A' //do something useful break; case: 'B' //do some other useful thing break; } above syntax might be a little off depending on your programming language of choice

OpenStudy (anonymous):

thanks

OpenStudy (anonymous):

never forget the default case.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!