home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.fan.starwars      Another Star Wars fan-base      46,595 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 46,038 of 46,595   
   Mr. Man-wai Chang to Robert Spanjaard   
   Re: New assignment/homework   
   13 Nov 16 14:32:12   
   
   XPost: comp.lang.c   
   From: toylet.toylet@gmail.com   
      
   On 13/11/2016 4:36 AM, Robert Spanjaard wrote:   
   > #include    
   >   
   > int main()   
   > {   
   >    char    chewb;    /* current character being processed */   
   >    int    r2d2,    /* number of numbers */   
   >        c3po;    /* number of letters */   
   >   
   >    while ((chewb = getchar()) != EOF)   
   >       if ((chewb >= 'a' && chewb <= 'z') || (chewb >= 'A' && chewb <= 'Z'))   
   >          ++c3po;   
   >       else if (chewb >= '0' && chewb <= '9')   
   >          ++r2d2;   
   >   
   >    printf("Number of letters: %i\nNumber of numbers: %i\n", c3po, r2d2);   
   >    return 0;   
   > }   
      
   Modify this program to count any char[1]! :)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca