Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- int _tmain(int argc, _TCHAR* argv[])
- {
- char str[50];
- std::cout<<"Enter a string: ";
- std::cin.getline(str, 50);
- int i=0, count=0;
- while (str[i]!='\0') {
- if ((i==0 || str[i-1]==' ') && str[i]>=65 && str[i]<90) {
- count++;
- }
- i++;
- }
- std::cout<<"The result is: "<<count<<"\n";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement