女人久久久www免费人成看片,国内自拍偷拍网,国产一区二区三区免费在线观看,欧美精品三区四区,91久久国产综合久久91,欧美成人精品第一区二区三区 ,美女成人在线观看

專業(yè)軟件設(shè)計(jì)師網(wǎng)站|培訓(xùn)機(jī)構(gòu)|服務(wù)商(加客服微信:cnitpm或QQ:800184589進(jìn)軟件設(shè)計(jì)師學(xué)霸群)

軟題庫(kù) 培訓(xùn)課程
當(dāng)前位置:信管網(wǎng) >> 軟件設(shè)計(jì)師 >> 案例分析 >> 文章內(nèi)容
軟件設(shè)計(jì)師下午真題及答案17
來源:信管網(wǎng) 2021年08月20日 【所有評(píng)論 分享到微信

為幫助廣大軟考中級(jí)軟件設(shè)計(jì)師考生更好備考,信管網(wǎng)特整理匯總了軟件設(shè)計(jì)師部分下午真題、答案及解析供考生查閱,并提供免費(fèi)在線模擬答題、歷年真題免費(fèi)下載等服務(wù),了解軟件設(shè)計(jì)師更多備考信息請(qǐng)關(guān)注信管網(wǎng)。

相關(guān)推薦:

點(diǎn)擊查看/下載:軟件設(shè)計(jì)師歷年真題匯總

點(diǎn)擊查看:軟件設(shè)計(jì)師在線培訓(xùn)課程免費(fèi)試聽課程

免費(fèi)練習(xí):軟件設(shè)計(jì)師考試題庫(kù)(模擬試題、章節(jié)練習(xí)、每日一練)

閱讀以下說明和c代碼,將應(yīng)填入 (n) 處的字句寫在的對(duì)應(yīng)欄內(nèi)。

【說明】

在一個(gè)簡(jiǎn)化的繪圖程序中,支持的圖形種類有點(diǎn)(point)和圓(circle),在設(shè)計(jì)過程中采用面向?qū)ο笏枷?,認(rèn)為所有的點(diǎn)和圓都是一種圖形(shape),并定義了類型shape t、 point t和circle t分別表示基本圖形、點(diǎn)和圓,并且點(diǎn)和圓具有基本圖形的所有特征。

【c代碼】

typedef enum { point,circle } shape type; /* 程序中的兩種圖形:點(diǎn)和圓 */

typedef struct { /* 基本的圖形類型 */

shape_type type; /* 圖形中類標(biāo)識(shí):點(diǎn)或者圓*/

void (*destroy) (); /* 銷毀圖形操作的函數(shù)指針*/

void (*draw) (); /* 繪制圖形操作的函數(shù)指針*/

} shape_t;

typedef struct { shape_t common; int x; iht y; } point_t; /* 定義點(diǎn)類

型, x, y為點(diǎn)坐標(biāo)*/

void destroypoint (point_t* this) { free (this); printf ("point destoryed!

\n"); } ) /* 銷毀點(diǎn)對(duì)象*/

void drawpoint(point_t* this) { printf("p(%d,%d)", this->x, this->y); }

/* 繪制點(diǎn)對(duì)象*/

shape_t* createpoint (va_list* ap) (/* 創(chuàng)建點(diǎn)對(duì)象,并設(shè)置其屬性*/

point_t* p_point;

if ( (p_point= (point_t*)malloc (sizeof (point_t)) ) ==null) returnnull;

p_point->common, type = point; p_point->common, destroy = destroypoint;

p_point->common.draw = drawpoint;

p_point->x = va_arg(*ap, int); /* 設(shè)置點(diǎn)的橫坐標(biāo)*/

p_point->y = va_arg(*ap, int); /* 設(shè)置點(diǎn)的縱坐標(biāo)*/

return (shape_t*)p_ooint; /*返回點(diǎn)對(duì)象指針*/

}

typedef struct { /*定義圓類型*/

shape_t common;

point_t 4center; /*圓心點(diǎn)*/

int radius; /*圓半徑*/

} circle_t;

void destroycircle(circle_t* this){

free( (1) ); free(this); printf("circle destoryed!\n");

}

void drawcircle(circle_t* this) {

print f ("c (");

(2) .draw(this->center); /*繪制圓心*/

printf(",%d) ", this->radius);

}

shape_t* createcircle(va_list4 ap) { /*創(chuàng)建一個(gè)圓,并設(shè)置其屬性*/

circle_t4 p circle;

if ((p_circle = (circle_t4)malloc (sizeof (circle_t)) ) ==null ) return null;

p_circle->common.type = circle; p_circle->common.destroy = destroy

circle;

p_circle->common.draw = drawcircle;

(3) = createpoint(ap); /* 設(shè)置圓心*/

p_circle->radius = va_arg(*ap, int); /* 設(shè)置圓半徑*/

return p_circle;

}

shape_t* createshape(shape_type st, "') { /* 創(chuàng)建某一種具體的圖形*/

va_list ap; /*可變參數(shù)列表*/

shape_t4 p_shape = null;

(4) (ap, st);

if( st == point ) p shape = createpoint(&ap); /* 創(chuàng)建點(diǎn)對(duì)象*/

if( st == circle ) p shape = createcircle(&ap); /*創(chuàng)建圓對(duì)象*/

va_end (ap);

return p_shape;

}

int main( ) {

int i; /* 循環(huán)控制變量,用于循環(huán)計(jì)數(shù)*/

shape_t* shapes[2]; /* 圖形指針數(shù)組,存儲(chǔ)圖形的地址*/

shapes[0] = createshape( point, 2, 3); /* 橫坐標(biāo)為2,比值坐標(biāo)為3*/

shapes[ii = createshape( circle, 20, 40, 10); /* 圓心坐標(biāo)(20,40),

半徑為 10*/

for(i=0 i<2; i++) { shapes[i]->draw(shapes[i]); printf("\n"); } /*

縱制數(shù)組中圖形*/

for( i = 1; i >= 0; i-- ) shapes[i]->destroy(shapes[i]); /* 銷毀

數(shù)組中圖形*/

return 0;

}

【運(yùn)行結(jié)果】

p(2,3)

(5)

circle destoryed !

point destoryed !

查看答案與解析:m.xiexiliangjiufa.com/st/2456118617.html

掃碼關(guān)注公眾號(hào)

溫馨提示:因考試政策、內(nèi)容不斷變化與調(diào)整,信管網(wǎng)網(wǎng)站提供的以上信息僅供參考,如有異議,請(qǐng)以權(quán)威部門公布的內(nèi)容為準(zhǔn)!

信管網(wǎng)致力于為廣大信管從業(yè)人員、愛好者、大學(xué)生提供專業(yè)、高質(zhì)量的課程和服務(wù),解決其考試證書、技能提升和就業(yè)的需求。

信管網(wǎng)軟考課程由信管網(wǎng)依托10年專業(yè)軟考教研傾力打造,官方教材參編作者和資深講師坐鎮(zhèn),通過深研歷年考試出題規(guī)律與考試大綱,深挖核心知識(shí)與高頻考點(diǎn),為學(xué)員考試保駕護(hù)航。面授、直播&錄播,多種班型靈活學(xué)習(xí),滿足不同學(xué)員考證需求,降低課程學(xué)習(xí)難度,使學(xué)習(xí)效果事半功倍。

相關(guān)內(nèi)容

發(fā)表評(píng)論  查看完整評(píng)論  

推薦文章