2012年9月8日

删除子串

摘要: #include <iostream.h>#include <string.h>void fun(char *a,char *b,char *c){ if (strlen(b)==0) { strcpy(c,a); return; } char *current=strstr(a,b); char *head=a; while (current!=NULL) { strncat(c,head,current-head); head=current+strlen(b); current... 阅读全文

posted @ 2012-09-08 22:05 为梦飞翔 阅读(237) 评论(0) 推荐(0)

堆排序

摘要: //堆排序#include <iostream.h>void main(){ int a[12]={2,4,6,34,31,24,65,37,87,68,90,23}; int b[12]; for (int i=0;i<12;i++) { b[i]=a[i]; int temp=i; while (temp-1>=0) { if (b[(temp-1)/2]<b[temp]) { int x=b[(temp-1)/2]; ... 阅读全文

posted @ 2012-09-08 11:54 为梦飞翔 阅读(213) 评论(0) 推荐(0)

导航