SHARE
TWEET

Esercizio 7 (Tutoraggio CE)

MartaFraioli Oct 20th, 2019 (edited) 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main(void){
  4.     char c;
  5.     int ch=0, wd=0, ro=0;
  6.     printf("Inserisci il testo da esaminare");
  7.     while(c != EOF){
  8.         c=getchar();
  9.         if (c == '\n'){
  10.             ro++;
  11.             wd++;
  12.         }
  13.         if (c == ' ' || c == '\t'){
  14.             wd++;
  15.         }
  16.         ch++;
  17.     }
  18.     printf("Numero di caratteri: %d\nNumero di parole:%d\nNumero di righe:%d", ch, wd, ro);
  19.     return 0;
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top