fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. #include <limits>
  5. using namespace std;
  6.  
  7. int main() {
  8. string user_input ="My very nice string";
  9. //getline(cin, user_input);
  10. string inverted_user_input = "";
  11.  
  12. for (auto i = user_input.length(); i >0 ; ) {
  13. inverted_user_input += user_input.at(--i);
  14. }
  15.  
  16. cout << "The reverse string is: " << inverted_user_input << endl;
  17.  
  18. cout << "Max integer: "<<setw(10)<< numeric_limits<int>::max() <<endl;
  19. cout << "Max size_t: "<<setw(10)<< numeric_limits<size_t>::max() <<endl;
  20. cout << "Max string size: "<<setw(10)<< user_input.max_size() <<endl;
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
The reverse string is: gnirts ecin yrev yM
Max integer:      2147483647
Max size_t:       4294967295
Max string size:  1073741820