您的位置::优盾五金网 >> 折叠梯

2002下C上机题之十二0电动阀门

时间:2022年07月21日

2002下C上机题之十二

2002下C上机题之十二 2011年12月10日 来源: 程序修改

code: /* 给定程序MODI1.C中的函数Creatlink的功能是创建带头结点的 单向链表, 并为各结点数据域赋0到m-1的值。 请改正函数Creatlink中指定部位的错误, 使它能得出正确的 结果。 注意: 不要改动main函数, 不得增行或删行, 也不得更改程序 的结构! */ #include #include #include typedef struct aa { int data; struct aa *next; } NODE; NODE *Creatlink(int n, int m) { NODE *h=NULL, *p, *s; int i; /**********found***********/ p=(NODE *)malloc(sizeof(NODE)); //p=(NODE )malloc(sizeof(NODE)); /* 老王注: 本行错误不知如何改, 可参考下面的 s=(NODE *)malloc(sizeof(NODE)); */ h=p; p->next=NULL; for(i=1; i <= n; i++) { s=(NODE *)malloc(sizeof(NODE)); s->data=rand()%m; s->next=p->next; p->next=s; p=p->next; } /**********found***********/ return h; //return p; } outlink(NODE *h) { NODE *p; p=h->next; printf("\n\nTHE LIST :\n\n HEAD "); while(p) { printf("->%d ",p->data); p=p->next; } printf("\n"); } main() { NODE *head; clrscr(); head=Creatlink(8,22); outlink(head); }

Test99编程题

code: /* 请编写函数fun, 函数的功能是:统计一行字符串中单词的个数, 作为函数值返回。一行字符串在主函数中输入, 规定所有单词由小 写字母组成, 单词之间由若干个空格隔开, 一行的开始没有空格。 注意:部分源程序在文件PROG1.C中。 请勿改动主函数main和其它函数中的任何内容,仅在函数fun的 花括号中填入你编写的若干语句。 */ #include #include #define N 80 int fun( char *s) {/**/ int n=0; for(; *s; s++) if(islower(*s) && !islower(*(s+1))) n++; /* 一行的结束也没有空格,这里可能是出题者设的一个“陷井”。 严格按出题者的要求,&& 的右边应为 (*(s+1)==' '||*(s+1)=='\0') 本处的写法用一切非小写字母作为定界,扩充了出题者的界定方法。*/ return n; /**/ } main() { char line[N]; int num=0; printf("Enter a string :\n"); gets(line); num=fun( line ); printf("The number of word is : %d\n\n",num); NONO(); } NONO() {/* 请在此函数内打开文件,输入测试数据,调用 fun 函数,输出数据,关闭文件。 */ FILE *rf, *wf ; int i, num ; char line[N], *p ; rf = fopen("bc.in", "r") ; wf = fopen("bc.out", "w") ; for(i = 0 ; i < 10 ; i++) { fgets(line, N, rf) ; p = strchr(line, '\n') ; if(p != NULL) *p = 0 ; num = fun(line) ; fprintf(wf, "%d\n", num) ; } fclose(rf) ; fclose(wf) ; }

bc.in 文件内容如下: you can create an index on any field on several fields to be used together or on parts thereof that you want to use as a key the

keys in indexes allow you quick access to specific records and define orders for sequential processing of a isam file after you no longer need an index you can delete it addition and indexes have no effect on the data records or on other indexes you may want a field in field in each record to uniquely identify that record from all other records in the file for example the employee number field is unique if you do not assign the same number to two different employees and you never reassign these numbers to other bc.out 文件内容应当如下: 14 14 12 12 13 8 14 12 14 10

var arrBaiduCproConfig=new Array(); arrBaiduCproConfig['uid'] =120380; arrBaiduCproConfig['n'] ='lw365cpr'; arrBaiduCproConfig['tm'] =30; arrBaiduCproConfig['cm'] =34; arrBaiduCproConfig['um'] =28; arrBaiduCproConfig['w'] =468; arrBaiduCproConfig['h'] =60; arrBaiduCproConfig['wn'] =2; arrBaiduCproConfig['hn'] =1; arrBaiduCproConfig['ta'] ='right'; arrBaiduCproConfig['tl'] ='bottom'; arrBaiduCproConfig['bu'] =0; arrBaiduCproConfig['bd'] ='#trans'; arrBaiduCproConfig['bg'] ='#trans'; arrBaiduCproConfig['tt'] ='#0000ff'; arrBaiduCproConfig['ct'] ='#444444'; arrBaiduCproConfig['url']

青岛治疗青少年白癜风的医院哪家好

西安华厦5个全飞秒传闻全部是假的

贵阳哪个医院治抑郁症比较好

垂体瘤内镜与显微镜手术的优缺点

重庆东大肛肠医院怎么样好评如潮市民心中的好医院

友情链接