[蓝桥杯]字符逆序

字符逆序

时间限制: 1Sec 内存限制: 64MB 提交: 6187 解决: 3006

题目描述
将一个字符串str的内容颠倒过来,并输出。str的长度不超过100个字符。
输入
输入包括一行。 第一行输入的字符串。
输出
输出转换好的逆序字符串。
样例输入
I am a student
样例输出
tneduts a ma I

解题思路

不难,很考验对基础知识的掌握,很基础

完整代码

#include<iostream> 
using namespace std;
#include<stdio.h>
#include<string.h>
int main()
{
	char str[100];
	gets(str);
	for(int i=strlen(str)-1;i>=0;i--)
		cout<<str[i];
	return 0;
}

猜你喜欢

转载自blog.csdn.net/DanBo_C/article/details/88359878
今日推荐