摘要: strcpy的所谓正确写法:char *strcpy(char *strDestination, const char *strSource) { assert(strDestination!=NULL && strSource!=NULL); char *strD=strDestination; while ((*strDestination++=*strSource++)!='\0') return strD; }char *strcat(char *strDest, const char *strSrc) { char *address ... 阅读全文
posted @ 2012-07-31 15:25 爱喝可乐 阅读(1486) 评论(0) 推荐(0) 编辑
摘要: 排序算法一般都是针对于数字进行排序,那char类型是否能排序呢?试一下。#include<stdio.h>#include <stdlib.h>void compare(char str[100],int length){ int change=5; for(int i=0;i<length;i++) { for(int j=0;j<length;j++) { //if(str[i]==str[j]) //{ //str[i]='\0'; //continue;... 阅读全文
posted @ 2012-07-31 13:36 爱喝可乐 阅读(1844) 评论(0) 推荐(0) 编辑
摘要: 思路,每一个5就会产生一个0,25=5*5,相当于两个5,也就会产生2个0,最后累加5的个数,不用所谓的阶乘#include<stdio.h>#include <stdlib.h>void main(){ int c; int t=0; printf("please enter anumber:"); scanf("%d",&c); for(int i=0;i<=c;i+=5) { int w=i; while(w/5&&!(w%5)) { t++; w=w/5; ... 阅读全文
posted @ 2012-07-31 11:07 爱喝可乐 阅读(226) 评论(0) 推荐(0) 编辑