哈工大机考:数组逆置

时间限制:1秒 空间限制:32768K

题目描述

输入一个字符串,长度小于等于200,然后将数组逆置输出。
输入描述:
测试数据有多组,每组输入一个字符串。


输出描述:
对于每组输入,请输出逆置后的结果。

输入例子:
hdssg

输出例子:
gssdh

代码:
#include <iostream>
#include  <stdio.h>
#include <string.h>
using namespace std;

int main(){
   char a[210];
    while(gets(a)){
     for(int i=strlen(a)-1;i>=0;i--){
        cout<<a[i];
     }
     cout<<endl;
    }
   return 0;
}
原文地址:https://www.cnblogs.com/mlgjb/p/6909181.html