随笔分类 -  C

c 自定义sqrt算法。
摘要:转载自:http://www.examw.com/biancheng/c/194822/#include #include #include #define ACC 0.000000001double newSqrt(double n){ double low, high, mid, tmp; if... 阅读全文

posted @ 2015-07-08 13:56 嘘寒问暖 阅读(486) 评论(0) 推荐(0)

c 链表交换节点的排序
摘要:#include typedef struct listnode { int f; struct listnode *next;} ListNode;ListNode *sort(ListNode *head){ ListNode *p,*p1,*p2,*p3; ListNo... 阅读全文

posted @ 2015-06-26 10:22 嘘寒问暖 阅读(701) 评论(0) 推荐(0)

c 查找替换字符串
摘要:#include #include char *mystrstr(char *s1, char *s2){ int i; if (*s2) { while(*s1) { for(i = 0; *(s1+i) == *(s2+i); i++) { if(!*(s2+i+1)) ... 阅读全文

posted @ 2015-06-25 12:22 嘘寒问暖 阅读(636) 评论(0) 推荐(0)

c 字符串压缩
摘要:#include #include //查找该元素是否已经存在int find(char t[],int len,char ch){ int i; for(i = 0; i < len; i++) { if (t[i] == ch) { return 1; } } return 0;}ch... 阅读全文

posted @ 2015-06-19 17:32 嘘寒问暖 阅读(563) 评论(0) 推荐(0)

c 链表实例
摘要:#include #include struct node{ int data; struct node *next;};typedef struct node NODE;typedef struct node * PNODE;PNODE constructlist( PNODE head,... 阅读全文

posted @ 2015-06-17 14:42 嘘寒问暖 阅读(271) 评论(0) 推荐(0)

c 删除字符串中的指定字符
摘要:#include #include void delChar(char *s, char ch){ int i,j; int len = strlen(s); for(i = 0; i < len; i++) { if(s[i] == ch) { for(j = i; j < len; ... 阅读全文

posted @ 2015-06-17 11:25 嘘寒问暖 阅读(1424) 评论(0) 推荐(0)

c 语言 格式化输出
摘要:#include int main(){ int i; unsigned int j; char input[ ]="10 0x1b aaaaaaaa bbbbbbbb"; char s[5]; sscanf(input,"%d %x %5[a-z] %*s %f",... 阅读全文

posted @ 2015-06-12 13:48 嘘寒问暖 阅读(204) 评论(0) 推荐(0)

c 查找 子字符串
摘要:#include int Search(char *s1, char *s2) { char *temp = s1; int count = 0; while(*temp != '\0') { char *tmp1 = temp; char *t1 = s2; while(*t1 != '\0... 阅读全文

posted @ 2015-06-10 17:27 嘘寒问暖 阅读(639) 评论(0) 推荐(0)

c strstr
摘要:#include int strend(char *s , char *t) { char *temp = s; while(*temp != '\0') { char *tmp1 = temp; char *t1 = t; while(*t1 != '\0' && *tmp1 != '\... 阅读全文

posted @ 2015-05-20 15:13 嘘寒问暖 阅读(207) 评论(0) 推荐(0)

c语言 金字塔
摘要:#include int main(){int n;int i,j;printf("输入金字塔层数:"); scanf("%d",&n);for(i=1;i=1;--j)printf(" %d", j);printf("\n");}return 0;} 阅读全文

posted @ 2014-12-08 11:12 嘘寒问暖 阅读(1131) 评论(0) 推荐(0)

c语言 结构体动态创建
摘要:1 #include 2 #include 3 struct Student 4 { 5 int num; //学号 6 int total; //总分 7 char name[20]; //姓名 8 float score[3]; //3个课目的分数 9 };1... 阅读全文

posted @ 2014-12-02 12:32 嘘寒问暖 阅读(9199) 评论(0) 推荐(0)

c语言 链表使用示例
摘要:1 #include 2 #include 3 #include 4 typedef struct list{ 5 struct list *next; 6 char name[30];//用户名称 7 char addr[50];//地址 8 ch... 阅读全文

posted @ 2014-12-01 09:33 嘘寒问暖 阅读(4999) 评论(0) 推荐(3)

c语言乘法表4种输出
摘要:1 #include 2 int main() 3 { 4 int i,j; 5 //左下角。 6 for (i=1;i=j) printf("%d×%d=%-2d ",j,i,j*i); 10 putchar('\n');11 }12 //左上角。13 putchar('\n... 阅读全文

posted @ 2014-11-25 09:56 嘘寒问暖 阅读(694) 评论(0) 推荐(0)

c语言读写文件操作
摘要:1 #include 2 #include 3 #include 4 void writefile() 5 { 6 FILE *fp; 7 fp = fopen("e://ss.txt","w+"); 8 if(fp == NULL) 9 {10 ... 阅读全文

posted @ 2014-11-05 15:37 嘘寒问暖 阅读(170) 评论(0) 推荐(0)

求100-1000之间的素数
摘要:1 #include 2 #include 3 int main() 4 { 5 int i=2, a=100, flag=0; 6 for (a=100;a<=1000;a++) 7 { 8 flag=0; 9 i= 2;10 ... 阅读全文

posted @ 2014-11-05 15:18 嘘寒问暖 阅读(495) 评论(0) 推荐(0)

c语言转二进制
摘要:1 #include 2 #include 3 #include 4 #include 5 //#include 6 // 7 //#include 8 //using namespace std; 9 10 #include 11 12 char temp[50] = "";13 14 v... 阅读全文

posted @ 2014-10-24 17:34 嘘寒问暖 阅读(1067) 评论(0) 推荐(0)

导航