• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    1994年程序員下午考試

    發布: 2007-5-26 13:59 | 作者: 未知 | 來源: 互聯網 | 查看: 27次 | 進入軟件測試論壇討論

    領測軟件測試網 【程 序】

     #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))

    if (p <= MAXSCORE)


    _________________________ ;


    if ( ______________________ )

    {

    gets(ch);

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

    continue;

    }

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


    if ( _______________ )

    {

    c++; score +=p; n++; s +=p;

    }

    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,f);

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

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

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

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

    }



     

    本程序實現安照每頁寬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];

    }

    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");

    }

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>