字符串字符反转

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zmqgeek/article/details/87950977
#include<iostream>
#include<cstring>
using namespace std;

int main()
{
	char str[20];
	gets(str);
    int len=strlen(str),top=0;
	char st[len];
	for(int i=0;i<len;i++)
	{
		st[top++]=str[i];
	}
	while(top>0)
	{
		cout<<st[--top];
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/zmqgeek/article/details/87950977