用指针方式,实现大小写字母户转,数字不变,遇到其他字符则停止转换并输出
摘要:char * strTest(char *ptr,int len); Action(){ char str[]={"thisis1998howol%dareyou!pleasetellme"}; int len=sizeof(str)/sizeof(char); lr_output_message(
阅读全文
posted @
2018-06-17 12:32
新美好时代
阅读(421)
推荐(0)
重写strcat函数,以实现strcat的功能
摘要:char * strcatTest(char *dst,const char *src);Action(){ char a[]="come on"; char b[]="every one"; char * result=strcatTest(a,b); lr_output_message("%s"
阅读全文
posted @
2018-06-17 12:30
新美好时代
阅读(431)
推荐(0)
重写strcpy函数,以实现strcpy的功能
摘要:char * strcpyTest(char *dst,const char *src);Action(){ char *ptr=(char*)malloc(100); char a[]={"this is a string..."}; char * result=strcpyTest(ptr,a)
阅读全文
posted @
2018-06-17 12:29
新美好时代
阅读(1183)
推荐(0)
用指针的方式实现,重写strrchr函数的功能
摘要:char *strchrTest(char * ptr,char c); Action(){ char str[]={"thisisadog"}; char c='s'; lr_output_message("%s",strchrTest(str,c)); return 0;}char *strch
阅读全文
posted @
2018-06-17 12:28
新美好时代
阅读(286)
推荐(0)
求指定整数数组的中位数
摘要://int a[]={12,43,56,14,78,16,50,26,30,40};的中位数//按数据从小到大排序,如果是奇数个数字,则中间那个数字为中位数;如果是偶数个数字,则中间2个数字的平均值为中位数。 int getSortedArr(int * a,int len){ int i,j,te
阅读全文
posted @
2018-06-17 12:27
新美好时代
阅读(390)
推荐(0)
求指定整数范围内的素数之和
摘要://求指定整数范围内的素数之和int getSumResult(int start,int end){ int i,j; int flag=0; int result=0; if(start<0||end <0) { lr_output_message("开始值、结束值需要为正整数"); exit(
阅读全文
posted @
2018-06-17 12:27
新美好时代
阅读(491)
推荐(0)
求一个数的阶乘
摘要://求一个数的阶乘int getDigit(int num){ int i; long result=1; if(num<0) { lr_output_message("你输入的是负数,没有阶乘"); } else { for(i=1;i<=num;i++) { result *=i; } //lr
阅读全文
posted @
2018-06-17 12:26
新美好时代
阅读(212)
推荐(0)