Friday, July 31, 2009

Can anyone help me with c++?

Provide a C++ code example that implements a conditional switch statement to provide a solution for the following scenario:If the value of char variable is ‘A’ , call a function to process credits, if the value is ‘C’ call a function to process cash, if the value is ‘U’ call a function to process unapproved customers. Create a function name for each function and pass an argument called “dblpayment

Can anyone help me with c++?
Unfortunately, the switch statement only works with integers. See the example below. If you HAVE to use a character code, you need to nest IF statements. I recommend converting your char to an int and then SWITCH on that like below. Good luck!





switch(integer_val){


case val_1:


// code to execute if integer_val is val_1


break;


...


case val_n:


// code to execute if integer_val is val_n


break;


default:


// code to execute if integer_val is none of the above


}


No comments:

Post a Comment