Advertisement
VERE6K

c++ h/w others

Nov 21st, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. void fifth ()
  9. {  
  10. string s;
  11. getline(cin,s);
  12. string str = s;
  13. for (int i = 0; i < s.size();i++){
  14. str[i] = s[s.size() - i - 1];
  15. }
  16. if ( s == str){
  17. cout << "YES";}
  18. else{
  19. cout << "NO";
  20. }
  21. }
  22.  
  23.  
  24. void fourth ()
  25. {
  26.     int y,t =1;
  27.     string p;
  28.     getline(cin,p);
  29.     y = p.length();
  30.     t = t + count(p.begin(), p.end(), ' ');
  31.     cout << "Result: " << t << endl;
  32. }
  33.  
  34.  
  35. void third()
  36. {
  37.     char z;
  38.     cin >> z;
  39.     if ((z >= 97) && (z <= 122)){
  40.         z = z - 32;
  41.         cout << z;
  42.     }else {
  43.        // if ((z >= 65) && (z <= 90)){
  44.             z = z + 32;
  45.         cout << z;
  46.     }
  47. }
  48.  
  49.  
  50. void second()
  51. {
  52.     char m;
  53.     cin >> m;
  54.     m -= 32;
  55.     cout << m;
  56. }
  57.  
  58.  
  59. void first()
  60. {
  61.     string s;
  62.     cin >> s;
  63.     if ((s == "0") && (s == "9") && (s == "1") && (s == "2") && (s == "3") && (s == "4") && (s == "5") && (s == "6") && (s == "7") && (s == "8")){
  64.             cout << "Yes";
  65.     }
  66.     else
  67.     {
  68.         cout << "No";
  69.     }
  70. }
  71.  
  72. int main()
  73. {
  74. int u;
  75. cout << "vvedite nomer zadachi" << endl;
  76. cin >> u;
  77. if (u == 1){
  78. first();
  79. }
  80. if (u == 2){
  81. second();
  82. }
  83. if (u == 3){
  84. third();
  85. }
  86. if (u == 4){
  87. fourth();
  88. }
  89. if (u == 5){
  90. fifth();
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement