字串反轉

#include <iostream>
#include "stdio.h"

using namespace std;

int main()
{
  char input[80];
  cout << "Input a string: ";
  cin >> input;

  int strLength = 0;
  while (input[strLength++] != '\0') ;

  cout << "The reversed input string is : ";

  for (int i = strLength - 2; i >= 0; i--){
      cout << input[i];
  }
  cout << endl;
}

results matching ""

    No results matching ""