首页 > 代码库 > <C Primer Plus>9 Introducing getchar() and putchar()

<C Primer Plus>9 Introducing getchar() and putchar()

 1 #include <stdio.h>
 2 #include <math.h>
 3 #define    SPACE ‘ ‘
 4 int main(void){
 5     char ch;
 6 
 7     while ((ch = getchar()) != \n){
 8         if (ch == SPACE){
 9             putchar(ch);
10         }
11         else{
12             putchar(ch + 1);
13         }
14     }
15     //putchar(ch);
16 
17     return 0;
18 }

REMEBER 

It demonstates a characteristic C programming style----combing two actions in one expression.

<C Primer Plus>9 Introducing getchar() and putchar()