/******
运行平台 VS2008 VC
******/
#include <string>
#include<stdio.h>
#include <iostream>
using namespace std;
string reverse_monny(long d)
{
char *buffer=new char[15];
sprintf(buffer, "%ld ",d); /*为什么字符串最后会加一个空格?如果参数是整型,不会出现这个问题*/
int n=strlen(buffer)-1; //由于后面加了一个空格,要去掉
buffer[n]='\0';
int j=0;
string str="";
string num="";
string pre_num="";
string flag="";
for (int i=0,j=n-1;i<n;i++,j=n-i-1)
{
switch(buffer[j])
{
case '0': {num="零"; break;}
case '1': {num="壹"; break;}
case '2': {num="贰"; break;}
case '3': {num="叁"; break;}
case '4': {num="肆"; break;}
case '5': {num="伍"; break;}
case '6': {num="陆"; break;}
case '7': {num="七"; break;}
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载