Advertisement
STANAANDREY

bacT11 SIII 2

May 25th, 2021
897
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctype.h>
  3. using namespace std;
  4. #define NMAX 103
  5. char s[NMAX];
  6.  
  7. int main() {
  8.     cin.getline(s, NMAX);
  9.     for (int i = 0; s[i]; i++) {
  10.         if (isalpha(s[i]) && (!i || s[i - 1] == ' ')) {
  11.             s[i] = toupper(s[i]);
  12.         } else {
  13.             s[i] = tolower(s[i]);
  14.         }
  15.     }
  16.     cout << s << endl;
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement