Advertisement
Ro_ro400_

Untitled

Dec 16th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7.     int careht_1=0;
  8.     int a=0;
  9.     char w[100];
  10.  
  11.     cout << "Type the words:";
  12.     cin.getline(w, 99);
  13.    
  14.     if(w[0] >='a'&& w[0] <='z')
  15.     {
  16.         a++;
  17.     }
  18.    
  19.     while (w[careht_1] > 0)
  20.     {
  21.         if ((w[careht_1]<'a')|| (w[careht_1]>'z'))
  22.             {
  23.             a++;
  24.             if ((w[careht_1+1]<'a')|| (w[careht_1+1]>'z') || (w[careht_1]==0))
  25.             {
  26.                 a=a-1;
  27.             }
  28.         }
  29.         careht_1++;
  30.     }
  31.    
  32.     cout <<a;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement