#include "stdafx.h"
#include <iostream>
#include <string.h>
using namespace std;
#define N 20
int _tmain(int argc, _TCHAR* argv[])
{
char str[N];
void string_reverse(char s[],int n);
cout<<"请输入一串字符串:"<<endl;
gets_s(str);
cout<<endl;
cout<<"倒序后:"<<endl;
string_reverse(str,N);
cout<<endl;
return 0;
}
//实现输入一个字符串,将其中的字符按逆序输出的函数
void string_reverse(char s[],int n)
{
int i;
for(i=strlen(s)-1;i>=0;i--)
cout<<s[i];
}
c++写一个函数,实现输入一个字符串,将其中的字符按逆序输出
猜你喜欢
转载自blog.csdn.net/qq_43090158/article/details/86211177
今日推荐
周排行