Hellko

Untitled

Mar 9th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int len; char temp;
  5. cin>>len;
  6. cin.ignore();
  7. char *str = new char[len+1];
  8. cin.getline(str,len+1);
  9. cout<<"\nInverse string: ";
  10.  
  11. for (int i=0; i<len/2; i++) {
  12. temp=str[len-i-1];
  13. str[len-i-1]=str[i];
  14. str[i]=temp;
  15. }
  16. cout<<str;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment