Advertisement
TwITe

Untitled

Aug 8th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. int task5() {
  2.     string s;
  3.     cin >> s;
  4.     bool k = true;
  5.     for (int i = 0; i < s.length(); i++) {
  6.         if (s[i] != s[s.length() - i - 1]) {
  7.             k = false;
  8.             break;
  9.         }
  10.     }
  11.     (k) ? cout << "yes" : cout << "no";
  12.     return 0;
  13. }
  14.  
  15. int task4() {
  16.     string s, s1;
  17.     int count = 1;
  18.     getline(cin, s);
  19.     for (char c : s) {
  20.         if (c == ' ') {
  21.             count++;
  22.         }
  23.     }
  24.     cout << count;
  25.     return 0;
  26. }
  27.  
  28. int task3() {
  29.     char c;
  30.     cin >> c;
  31.     if (c >= 'a' && c <= 'z') {
  32.         c = c - 'a' + 'A';
  33.     }
  34.     else if (c >= 'A' && c <= 'Z') {
  35.         c = c - 'A' + 'a';
  36.     }
  37.     cout << c;
  38.     return 0;
  39. }
  40.  
  41. int task2() {
  42.     char c;
  43.     cin >> c;
  44.     (c >= 'a' && c <= 'z') ? cout << (c = c - 'a' + 'A') : cout << c;
  45.     return 0;
  46. }
  47.  
  48. int task1() {
  49.     char c;
  50.     cin >> c;
  51.     (c >= '0' && c <= '9') ? cout << "yes" : cout << "no";
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement