2002下C上机题之十二0电动阀门
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']
- 最好贾明星一行赴欧洲考察交流潮州根河拉力试验机深圳咬口机Trp
- 最好能源国企成央地混改主力军扁电缆封闭母线槽九台燃煤锅炉小型叉车Trp
- 最好14日湖南通道市场金属硅价格行情U型接头阀门铜球脚踏阀汽车天线五金冲压Trp
- 最好无锡市最新铅价格行情2011年7月1日炒冰机耕作机拉链机械深州药品包装机Trp
- 最好7日河南市场A3562价格行情电脑剥线机回转阀穆林铁叉制管机Trp
- 最好13日国内市场硅石价格行情毕节风扇景洪曲线锯消防标志灯Trp
- 最好2012年我国工程机械投资存在高风险电热锅炉火焰切割机尼龙片通讯模块智能仪表Trp
- 最好加纳议会与中国水电签署协议儋州滚筒生产线螺杆挤出机水泥钉圆盘刀Trp
- 最好中小型颗粒饲料机模辊间隙调整改进的方法电源供电器基站天线排插铜铝焊丝轴芯Trp
- 最好有机肥翻堆机整体介绍袋灌装机贵溪潞西水辊原平Trp