c语言网-1093-字符逆序

题目描述

将一个字符串str的内容颠倒过来,并输出。str的长度不超过100个字符。

输入

输入包括一行。 第一行输入的字符串。

输出

输出转换好的逆序字符串。

样例输入

I am a student

样例输出

tneduts a ma I
# include <iostream>
 # include <cstring>
 using namespace std;
 int main ()
 {
 	char a[101];
 	cin.getline(a,101,'\n');
 	for(int b=strlen(a)-1;b>=0;b--)
 	{
 		cout<<a[b];
	 }
 }

猜你喜欢

转载自blog.csdn.net/ljh9640/article/details/83827277