Sunday, April 18, 2010

Lung Cancer Main Characte

ATM using case

This example simulates an ATM, except that, unlike the previous example where we did conditional, it works with cases, ie using SWITCH

  # include \u0026lt; ; iostream.h>  

int a = 0;
int main (void )

{court \u0026lt;\u0026lt;"Welcome to your cashier \\ n Please select who you want to do: \\ n 1 . Allocation \\ n 2. Retiro \\ n 3. Payment of Services \\ n 4. Change Password \\ n 5. Check Balance \\ n "\u0026lt;\u0026lt;endl;
cin>> a;
switch (a) {

case (1):

{court \u0026lt;\u0026lt;"You chose to make a consignment \\ n Thank you for visiting" \u0026lt;\u0026lt;endl ;
break;}

case (2):

{court \u0026lt;\u0026lt;"You chose to make a withdrawal \\ n Thank you for visiting" \u0026lt;\u0026lt;endl;
break;}

case (3):

{court \u0026lt;\u0026lt;"You chose make payment for services \\ n Thank you for visiting" \u0026lt;\u0026lt;endl;
break;}

case (4):

{court \u0026lt;\u0026lt;"You chose to change your password \\ n Thank you for visiting" \u0026lt;\u0026lt;endl;
break;}

case (5):

{court \u0026lt;\u0026lt;"You chose to make a balance inquiry \\ n Thank you for visiting" \u0026lt;\u0026lt;endl;
break;}

default: {

court \u0026lt;\u0026lt;"The number entered does not correspond to a valid option \\ n Thank you for visiting" \u0026lt;\u0026lt;endl;
break;}


} system ("pause");
return 0;}
will notice that each case is assigned, we must define a block of statements, all of this, using SWITCH, and at the end, we use the statement or if DEFAULT to indicate a block to be executed if not select a predefined event.

0 comments:

Post a Comment