---
title: "递归   倒序输出"
author: "smallearth"
date: "2012-03-10T17:07:00Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2013-11-30T20:10:51Z"
id: 1983341
url: "https://smallearth.iteye.com/blog/1983341"
---

输入类是abcd的字符串，要求使用递归实现反转字符串，使输出结果为dcba

#include "stdafx.h"

#include&lt;iostream&gt;  
#include&lt;time.h&gt;  
using namespace std;  
void D(int);  
int main()  
{

cout&lt;&lt;char(100)&lt;&lt;" "&lt;&lt;char(99)&lt;&lt; " "&lt;&lt;char(98)&lt;&lt;" "&lt;&lt;char(97)&lt;&lt;endl;

cout&lt;&lt;clock()&lt;&lt;endl;  
return 0;

}

void D(int n )  
{  
char i;

if(n==97)

{i='a';}

else  
i=char(n-1)+1;

}