193030

2012 01. A. Обърнато число (РУ втори кръг)

Mar 31st, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <string>
  4. #include <string.h>
  5. #include <cstdlib>
  6. #include <sstream>      // std::stringstream
  7.  
  8. using namespace std;
  9.  
  10.  
  11. string input = "123";
  12. string output;
  13. int main()
  14. {
  15.  
  16.     getline(cin, input);
  17.  
  18.     int sizeOfInput = input.size();
  19.     char arrayOutput[sizeOfInput] = {};
  20.     int j =0;
  21.     for(int i = sizeOfInput-1; i>=0; i--)
  22.     {
  23.  
  24.         arrayOutput[j] = input[i];
  25.         j++;
  26.     }
  27.     for(int i = 0; i<= sizeOfInput; i++)
  28.     {
  29.         cout << arrayOutput[i];
  30.     }
  31.     cout << output << endl;
  32.  
  33.  
  34. }
Add Comment
Please, Sign In to add comment