Around 08:56pm on Thursday, June 18, 2009 (UK time), ayyaz scrawled:

>      switch (choice = getchar()) {
>      case 'r':
> 
>      case 'R':
>          printf("RED");
>          break;
> 
>      case 'w':
> 
>      case 'W':
>          printf("WHITE");
>          break;
>      }

> Should it not only output 'RED' or 'WHITE' when you enter 'R' or 'W'?

You don't have a break following the case 'r': and case 'w': statements.
So control passes to the next statement - the corrosponding upper case
ones.

Steve

-- 
 
 Play Champions - my free football predictions game at:
        http://www.stevesearle.com/champs/about.html

 21:47:19 up 40 days,  8:11,  1 user,  load average: 0.04, 0.08, 0.04

Reply via email to