C语言
文章平均质量分 77
vanish_dust
永远不要低估坚持的力量!
展开
-
约瑟夫问题
#include #include typedef struct node* link;struct node { int item; link next; };main() { int i, N , M; scanf("%d %d",&N,&M); link t = malloc(sizeof *t), x = t; t->item = 1; t->next转载 2014-11-12 22:14:56 · 418 阅读 · 0 评论 -
结构体 自引用
1.定义与声明结构体的定义如下所示,struct为结构体关键字,tag为结构体的标志,member-list为结构体成员列表,其必须列出其所有成员;variable-list为此结构体声明的变量。[cpp] view plaincopystruct tag { member-list } variable-list ;转载 2014-11-05 15:23:02 · 498 阅读 · 0 评论 -
格式转换
#include #include int main(){ char c; int first_n = 0; //第一个空格 int first_s = 0; //第一个sum 24 int sum = 0; FILE *fp_r,*fp_w; if((fp_r = fopen("R.txt","r"))==NULL) {原创 2014-12-01 19:19:34 · 421 阅读 · 0 评论 -
分治的思想
#include int max(int a[],int l,int r);int main(){ int s[11]={4,5,12,43,22,44,77,123,423,33,22}; int b = max(s,0,10); printf("%d",b); return 0;}int max(int a[],int l,int r){原创 2014-12-03 14:24:56 · 457 阅读 · 0 评论 -
scanf中运用正则表达式
怎样从中取出tom?char * url="";char uri[10]={0};sscanf(url,"%*[^:]:%[^@]",uri);转贴:在softmse (Jake) 的问题贴http://community.csdn.net/Expert/topic/4843/4843294.xml?temp=. 4321558中 ,周星星给出了一个很cool的sscanf用例转载 2014-12-05 11:34:48 · 648 阅读 · 0 评论