Advertisement
TheWhiteFang

Tutorial 4 Section A (c) [Reverse string]

Nov 16th, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. // http://pastebin.com/u/TheWhiteFang
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7.  
  8.  
  9. int main(){
  10.  
  11.     string name = " ";
  12.     string namerev = " ";
  13.  
  14.  
  15.     cout << "Please enter a string:\n";
  16.     getline(cin, name);
  17.     cout << endl;
  18.  
  19.     name = string(name.rbegin(), name.rend());
  20.     cout <<"Your reversed text is:\n"<< name << " and the length is "<< name.length() << endl <<endl;//partA
  21.  
  22.  
  23.     return 0;
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement