Advertisement
ignatif

Untitled

Dec 1st, 2015
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. /*Лабораторная работа №11
  2.  *Группа: 80-103б
  3.  *Игнатьев Максим
  4.  *Вариант №22
  5.  */
  6.  
  7. #include <stdio.h>
  8. #include <ctype.h>
  9. using namespace std;
  10.  
  11. int main(){
  12.     int length = 0, number = 0;
  13.     char ch;
  14.     printf("Insert text: \n");
  15.     while(ch != EOF){
  16.         ch = getchar();
  17.         if (isalpha(ch)) {length += 1; continue;}
  18.         if (isspace(ch) || ch == ',') {
  19.             if (length >= 3) number += 1;
  20.             length = 0;
  21.         }
  22.         if (ch == '\n') {
  23.             printf("%d\n", number);
  24.             number = 0;
  25.             printf("Insert text: \n");
  26.         }
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement