首页 > 代码库 > 哈工大机考:数组逆置
哈工大机考:数组逆置
时间限制: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; }
哈工大机考:数组逆置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。