Advertisement
Ivan_Moscow

3.1.14.

May 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3.  
  4. int _tmain(int argc, _TCHAR* argv[])
  5. {
  6.     char str[50];
  7.     std::cout<<"Enter a string: ";
  8.     std::cin.getline(str, 50);
  9.     int i=0, count=0;
  10.     while (str[i]!='\0') {
  11.         if ((i==0 || str[i-1]==' ') && str[i]>=65 && str[i]<90) {
  12.             count++;
  13.         }
  14.         i++;
  15.     }
  16.     std::cout<<"The result is: "<<count<<"\n";
  17.     system("pause");
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement