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

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

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

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

相關(guān)推薦:

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

點擊查看:軟件設(shè)計師在線培訓(xùn)課程 丨 免費試聽課程

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

試題一、

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

【說明】

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

【c代碼】

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

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

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

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

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

} shape_t;

typedef struct { shape_t common; int x; iht y; } point_t; /* 定義點類

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

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

\n"); } ) /* 銷毀點對象*/

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

/* 繪制點對象*/

shape_t* createpoint (va_list* ap) (/* 創(chuàng)建點對象,并設(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è)置點的橫坐標(biāo)*/

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

return (shape_t*)p_ooint; /*返回點對象指針*/

}

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

shape_t common;

point_t 4center; /*圓心點*/

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)建一個圓,并設(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)建點對象*/

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

va_end (ap);

return p_shape;

}

int main( ) {

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

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

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;

}

【運行結(jié)果】

p(2,3)

(5)

circle destoryed !

point destoryed !

信管網(wǎng)參考答案:

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

試題二、

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

【說明】

某大型購物中心欲開發(fā)一套收銀軟件,要求其能夠支持購物中心在不同時期推出的各種促銷活動,如打折、返利(例如,滿300返100)等等?,F(xiàn)采用策略(strategy)模式實現(xiàn)該要求,得到如圖5-1所示的類圖。

圖5-1 策略模式類圖

【c++代碼】

#include

using namespace std;

enum type{normal, cash_discount, cash_return};

class cashsuper{

public:

(1);

};

class cashnormal : public cashsuper { //正常收費子類

public:

double acceptcash(double money) { retum money; }

};

class cashdiscount : public cashsuper {

private:

double moneydiscount; // 折扣率

public:

cashdiscount(double discount) { moneydiscount= discount; }

double acceptcash(double money) { retum money * moneydiscount; }

};

class cashretum : public cashsuper { // 滿額返利

private:

double moneycondition; // 滿額數(shù)額

double moneyreturn; // 返利數(shù)額

public:

cashretnm(double motieycondition, double moneyreturn) {

this->moneycondition=moneycondition;

this->moneyreturn=moneyreturn;

}

double acceptcash(double money) {

double result = money;

if(money>=moneycondition)

result=money-(int)(money/moneycondition ) * moneyreturn;

return result ;

}

};

class cashcontext {

private:

cashsuper *cs;

public:

cashcontext(int type) {

switch(type) {

case normal: //正常收費

(2) ;

break;

case cash_return: //滿300返100

(3) ;

break;

case cash_discount: //打八折

(4) ;

break;

}

}

double getresult(double money) {

(5) ;

}

};

//此處略去main()函數(shù)

查看答案及解析:m.xiexiliangjiufa.com/st/3816115424.html

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

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

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

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

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

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

推薦文章