大写字母后排的解决算法.docVIP

  • 2
  • 0
  • 约3.98千字
  • 约 19页
  • 2019-10-25 发布于湖北
  • 举报
一道编程赛题——大写字母后排 题目以及要求:把一个字符串的大写字母放到字符串的后面,各个字符的相对位置不变,不能申请额外的空间。 以下是我的算法: //test_char_exchange.h #ifndef _TEST_EXCHANGE_ #define _TEST_EXCHANGE_ typedef int (*TFUN)(char*,int,int); int exchange(char*cs,int f,int r);//cs:需要字符串排序的数组,f,左下表,r:右下标 int mySort(char*cs,int f,int r); void swap(char*,char*); int test(TFUN t);//测试程序 int test2(); extern long sum; #endif //test_char_exchange.cpp #includetest_char_exchange.h #includestdlib.h #includestdio.h #includemath.h int isup(char c) {return c=Ac=Z?1:0;} void swap(char *c1,char *c2) {int t=*c1;*c1=*c2;*c2=t;} //cs[b:e]部分翻转 void reverse_ex(char*cs,int

文档评论(0)

1亿VIP精品文档

相关文档