设为首页  
联系我们  
加入收藏  
网页制作 冲浪宝典 图形图像 操作系统 软件教学 编程开发 认证考试 安全技术 站长专区 文学驿站 娱乐天地 游戏天地 办公软件
文章搜索
您的位置: 首页 >> 文章首页 >> 认证考试 >> 软件水平考试 >> 1994年程序员考试-下午试题
精品推荐
软件水平考试点击TOP10
·1993年程序员考试上午试题
·我的软考经验 希望能助你取得成功
·2004年数据库系统工程师考试大纲
·2005年4月等级考试二级VB真题(附答案)
·2004年网络工程师考试大纲
·“新软考”取消诸多门槛 大学生也可获高级职称
·2004年软件设计师级考试大纲
·报考条件放宽在校学生可被评为高级工程师
·软件水平考试备考要略
·2004年5月系统分析员考试大纲
认证考试点击TOP10
·个人简历表格
·小学教师述职报告
·个人简历样本
·大学毕业生个人简历
·学生个人简历
·个人简历范文
·求职面试自我介绍一分钟
·大学生暑期三下乡社会实践报告
·Adobe Photoshop 认证试题一
·个人简历模板-标准简历(简历模板)
精选专题

1994年程序员考试-下午试题

作者: 来源:http://www.xgdown.com/ 时间:2005-11-8 0:27:23

1994年程序员考试-下午试题(1)

【程 序】

 #define MAXSCORE 20

#define QUESTION 10

#define ORDERS 5

main()

{ int p[QUESTION]={0,0,0,0,0,0,0,0,0,0},

n[QUESTION]={0,0,0,0,0,0,0,0,0,0},

s[QUESTION]={0,0,0,0,0,0,0,0,0,0};

int f[ORDERS]={0,0,0,0,0};

int i,score,c,number,pn=0;

char fig,ch[120];

char *title[]={" 90 -- 100 A",

" 80 -- 89 B",

" 70 -- 79 C",

" 60 -- 69 D",

" 0 -- 59 E"}

while(1)

{

printf("Enter number && score1 -- score10 \n");

if (scanf("%d",&number) ==0)

{

gets(ch);

printf("Error! Input again!\n");

continue;

}

for (c=0,i=1;i<QUESTION && c== i; i++)

if (scanf("%d",&p[i]))

if (p[i] <= MAXSCORE)

_________________________ ;

if ( ______________________ )

{

gets(ch);

printf("Error! Input again!\n");

continue;

}

for (c=0,score=0,i=0;i<QUESTION;i++)

if ( _______________ )

{

C++; score +=p[i]; n[i]++; s[i] +=p[i];

}

fig = (score ==100) ? 'A': (score < 60) ? _____________________;

f[ _______ ]++; pn++;

printf("Number = %d Score = %d Mark = %c\n",number,score,fig);

}

printf("STUDENTS = %d\n",pn);

for (i=0;i<ORDERS;i++) printf("%s%7d\n",title[i],f[i]);

printf("\n Question Students Average\n");

for (i=0;i<QUESTION;i++)

if (n[i]) printf("%6d%10d%10.2f\n",i+1,n[i], _______________ );

else pritnf ("6d%10d%10s\n",i+1,n[i]," --");

}

 

本程序实现安照每页宽80列平均分左右两栏的格式

印出正文文件内容.

程序引入数组buff[] [] [] 和ln [] [], 将从文件

读出的字符按行存储于buff[0],行号存于ln[0](对应左栏

), 或buff[1],ln[1](对应右栏).约定,文件内容先填左栏

填满后,再填右栏.或左右两栏填满,或文件内容填完,输出

一页的内容.

欲输出的正文文件(小于1000行)的文件名作为主函数

的参数.主函数以文件名为参数调用函数dprint()输出一个

文件.函数dprint()读取文件内容,控制栏中的一行内容的

填写,当一行填满时,调用函数nextline().函数nextline()

控制栏中行的变化,左右栏的变化.待左右栏都填满时,调用

函数printout()完成整页输出.函数printout()完成页面排

版,取ln[0] buff[0]和ln[1] buff[1],将对应行号及内容

填入line[],逐行输出.

【程 序】

#include <stdio.h>

#define LL 80

#define COL 2

#define CSIZE LL/COL-9

#define PL 50

#define MARGIN 3

char buff[COL][PL][CSIZE];

int ln[COL][PL];

int col,row,p;

dprint(char *fname)

{ FILE *fp;

int lin,c;

if ((fp=fopen(fname,"r"))==NULL) return;

lin =0; p=0; col=0; c=getc(fp);

while (c!=EOF)

{ ln[col][row]=++lin;

while (c != '\n' && c != EOF)

{ if (p>= CSIZE)

{

_________________ ; ln[col][row] = 0;

}

_________________ = c ; c = getc(fp);

}

____________________ ;

if (c != EOF) c = getc(fp);

}

while( col != 0 row != 0 )

{ ln[col][row] = 0;

nextline();

}

fclose(fp);

}

nextline()

{ while(p < CSIZE)

buff[col][row][p++] = ' ';

if ( _____________ )

{ if ( ++col >= COL )

{ printout();

_______________;

}

row = 0;

}

p = 0;

}

printout()

{ int k, i, lpos, col, d;

char line[LL];

for(k=0;k<MARGIN;k++) putchar('\n');

for(k=0;k<PL;k++)

{ for(i=0;i<LL-1;i++)

for(lpos=0,col=0;col<COL;lpos += CSIZE+9,

col++)

{ d = _____________;

p = lpos + 4;

while (d>0)

{ line[p--] = _______________;

d /= 10;

}

for(p=lpos+7,i=0;i<CSIZE;i++)

line[p++] = buff[col][k][i];

}

puts(line);

}

for(k=0;k<MARGIN;k++) putchar('\n');

}

main(int argc, char **argv)

{ int f;

for(f=1;f<argc;f++)

dprint(argc[f]);

}

本程序给出两个函数.函数create()根据已知整数数组构造一个线性链表.函

数sort()采用选择排序方法对已知链表进行排序.为排序方便,函数sort()于排

序前在链表首表元之前生成一个辅助表元.排序完成后,将该辅助表元筛去.

【程 序】

#include <stdio.h>

#include <stdlib.h>

strUCt node{

int value;

struct node *next;

};

struct node *create(int a[], int n)

{ struct node *h, *q;

for(h=NULL;n;n--)

{ q = (struct node *)malloc(sizeof(struct node));

q->value = ____________;

______________;

______________;

}

return h;

}

void sort(struct node **h)

{ struct node *p,*q,*r,*s,*hl;

hl = p = (struct node*)malloc(sizeof(struct node));

p->next = *h;

while(p->next != NULL)

{ q = p->next;

r = p;

while(p->next != NULL)

{ if (q->next->value < __________ )

r = q;

q = q->next;

}

if( r != p )

{ s = ____________;

_____________ = s->next;

s->next = ___________;

___________ = s;

}

p = p->next;

}

*h = hl->next;

free(hl);

}

int text_data[] = {5,9,3,4,5,7,8};

main()

{ struct node *h, *p;

h = create(test_data,

sizeof test_data/size of test_data);

for(p=h;p;p=p->next) printf("%5d",p->value);

printf("\n");

sort(&h);

for(p=h;p;p=p->next) printf("%5d",p->value);

printf("\n");

}

共2页 9 7 [1] [28 :>

1994年程序员考试-下午试题 相关文章:
1994年程序员考试-下午试题 相关软件:
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
转载请注明来源:http://www.xgdown.com