winnie mong
Junior Member level 3
- Joined
- Sep 8, 2013
- Messages
- 26
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 366
hi guys,
i have a question concerning the use of the switch statement.i am wondering if case zero corresponds with state 0 and case1 corresponds with state1.with my code below, i want case 0 to execute,which will then state=1 and for state 1 i want i want case 2 to execute.so i am not sure if thats how thw switch statement works.some body help!!
i have a question concerning the use of the switch statement.i am wondering if case zero corresponds with state 0 and case1 corresponds with state1.with my code below, i want case 0 to execute,which will then state=1 and for state 1 i want i want case 2 to execute.so i am not sure if thats how thw switch statement works.some body help!!
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 int i,j,state; void geyser_state_check(); void do_set_time ( const char *const menu2[]); do{ state=0; { switch (state){ case 0: geyser_state_check(); if (mode()){ state=1; } break; case 1: j=choice(menu1); if (menu1[j]=SET TIME){ do_set_time(); break; } else if(menu1[j]=VIEW TIME){ do_view_time(); break; } else { state=0; break; } break; } } }while(1);
Last edited by a moderator: