freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

20xx數(shù)據(jù)結(jié)構(gòu)課程設(shè)計-在線瀏覽

2024-10-16 20:46本頁面
  

【正文】 mial))。temp1=(Polyn)malloc(sizeof(struct Polynomial))。temp2=(Polyn)malloc(sizeof(struct Polynomial))。temp1=Add(temp1,pa)。amp。temp2nextcoef=(qacoef)/(qbcoef)。Insert(temp2next,hf)。15qa=panext。}pf=Subtract(temp1,Multiply(hf,pb))。printf(“商是:”)。printf(“余數(shù)是:”)。} void main(){ int choose=1。system(“Color E0”)。//定義各式的頭指針,pa與pb在使用前付初值NULL printf(“請輸入A(x)的項數(shù):”)。m)。pa=Create(pa,m)。printf(“請輸入B(x)的項數(shù):”)。n)。pb=Create(pb,n)。printf(“**********************************************n”)。printf(”tt “)。printf(”tt “)。printf(”tt “)。printf(”**********************************************n“)。scanf(”%d“,amp。switch(flag){case 1:printf(”多項式A(x):“)。*n”)。Print(pb)。case 2:pc=Add(pa,pb)。Print(pc)。break。printf(“多項式A(x)B(x):”)。Destroy(pd)。case 4:pf=Multiply(pa,pb)。Print(pf)。break。18break。break。Destroy(pb)。若設(shè)定的迷宮不存在通路,則報告相應(yīng)信息。然而,只需要對迷宮求解的函數(shù)做小量修改,便可求得全部路徑。e)素Push(amp。S,e)返回其值 }ADT Stack;⒉ 迷宮的抽象數(shù)據(jù)類型定義: ADT Maze{ 數(shù)據(jù)對象:D:={aij,Start,end|aij,Start,end∈{} 0≤i≤m+2,0≤j≤n+2,m,n≥0}數(shù)據(jù)關(guān)系:R={} Row={|ai1,aij∈D i=1,?,m+2,j=1,?,n+2}第1頁操作結(jié)果構(gòu)造一個空棧,完成棧用e返回棧S的棧頂元將新的元素e壓入棧頂 刪除棧頂元素,并用eInitStack(amp。s)初始條件:已知目前迷宮狀態(tài), 傳過起始位置,和終止位置 操作結(jié)果:搜索迷宮,用sqstack s返回搜索所得路徑。typedef struct { int r。}PostType。//通道塊在路徑上的序號PostType seat。//通道塊指向下一通道塊的方向 }SElemType。//棧底指針SElemType *top。//棧的最大容量 }Stack。S)//初始化棧 { =(SElemType *)malloc(STACK_INIT_SIZE*sizeof(SElemType))。//存儲分配失敗。=STACK_INIT_SIZE。}//InitStackStatus StackEmpty(Stack S)//判斷棧是否為空,如果為空返回TRUE,否則返回FALSE { if(==)return TRUE。}//StackEmptyStatus Push(Stack amp。if(!)exit(OVERFLOW)。+=STACK_INCREMENT。return OK。S,SElemType amp。e=*。}//PopStatus DestroyStack(Stack amp。=。}//DestroyStack// define MAXLEN 20//迷宮包括外墻最大行列數(shù)目 typedef struct{int r。char adr[MAXLEN][MAXLEN]。 39。*39。39。39。//迷宮類型Status InitMaze(MazeType amp。printf(“輸入迷口的行數(shù)和列數(shù): ”)。,amp。//迷宮行和列數(shù)for(i=0。39。39。i[i][0]=39。[i][+1]=39。}for(i=1。j[i][j]=39。//初始化迷宮printf(“輸入障礙物%d的坐標(以坐標(0,0)結(jié)束輸入): ”,k)。m,amp。k++。[m][n]=39。//迷宮障礙用39。標記printf(“輸入障礙物%d的坐標(以坐標(0,0)結(jié)束輸入): ”,k)。m,amp。k++。}//InitMazeStatus Pass(MazeType maze,PostType curpos){ //當前位置可通則返回TURE,否則返回FALSEif([][]==39。)//可通return TRUE。}//PassStatus FootPrint(MazeType amp。*39。}//FootPrintPostType NextPos(PostType amp。cpos=curpos。break。break。break。break。}return cpos。maze,PostType curpos){ //曾走過但不是通路標記并返回OK第5頁 山東科技大學(xué)學(xué)生課程設(shè)計[][]=39。//“”表示曾走過但不通return OK。maze)//將最后標記好的迷宮輸出 { int i,j。for(i=0。//輸出列數(shù)printf(“n”)。iprintf(“%d”,i)。jprintf(“%4c”,[i][j])。} }//PrintMazeStatus MazePath(MazeType amp。//初始化棧PostType curpos。SElemType e。curpos=start。do {if(Pass(maze,curpos))//當前位置可通過而未曾走過留下足跡{FootPrint(maze,curpos)。=curpos。Push(S,e)。amp。else return TRUE。//下一位置是當前位置curstep++。//提取前一位置while(==4 amp。!StackEmpty(S))//4個方向都不能通過則留下記號 提取前一個位置進行判斷是否是能通過{MarkPrint(maze,)。}if(設(shè)定當前位置為該新方向上的鄰位{++。curpos=NextPos(,)。if(!DestroyStack(S))exit(ERROR)。}//MazePathint main(){ MazeType maze。char c。if(!InitMaze(maze)){printf(“n 初始化迷宮失敗!!”)。}do{printf(“n請輸入入口的坐標:”)。,amp。//輸入入口坐標if( || )printf(“n輸入錯誤,請重新輸入入口的坐標!n”)。}while( || )。//輸入出口的坐標scanf(“%d%d”,amp。)。continue。if(!MazePath(maze,start,end))printf(“n不能找到一條路徑!!n”)。//輸出迷宮printf(“是否要繼續(xù)?(y/n):”)。c)。y39。Y39。}。二、概要設(shè)計:void insert(PLOYList *head,PLOYList *input)//查找位置插入新鏈節(jié)的函數(shù),且讓輸入的多項式呈降序排列 PLOYList *creat(char ch)//輸入多項式PLOYList *add(PLOYList *head,PLOYList *pre)//多項式相加,head為第一個多項式建立的鏈表表頭,pre為第二個多項式建立的鏈表表頭PLOYList *sub(PLOYList *head,PLOYList *pre)//多項式相減PLOYList *mul(PLOYList *head,PLOYList *pre)//多項式相乘PLOYList *der(PLOYList *head)//多項式求導(dǎo)void print(PLOYList *fun)//輸出多項式,fun指要輸出的多項式鏈表的表頭 void start()//用戶選擇界面三、詳細設(shè)計:include include typedef struct node//定義節(jié)點類型 { float coef。//多項式的指數(shù)struct node * next。void insert(PLOYList *head,PLOYList *input)//查找位置插入新鏈節(jié)的函數(shù),且讓輸入的多項式呈降序排列 {PLOYList *pre,*now。pre=head。} //如果只有一個頭結(jié)點,則把新結(jié)點直接連在后面else {now=prenext。signal=1。now=prenext。prenext=input。}//若新結(jié)點中指數(shù)比最后一個結(jié)點即now中的指數(shù)大,則插入now之前else//若指數(shù)相等則需合并為一個結(jié)點,若相加后指數(shù)為0則釋放該結(jié)點{nowcoef=nowcoef+inputcoef。free(input)。free(now)。float x。head=(PLOYList *)malloc(sizeof(PLOYList))。scanf(“%f %d”,amp。y)。//創(chuàng)建新鏈節(jié)inputcoef=x。inputnext=NULL。//每輸入一項就將其排序,是的鏈表中多項式呈降序排列scanf(“%f %d”,amp。y)。}PLOYList *add(PLOYList *head,PLOYList *pre)//多項式相加,head為第一個多項式建立的鏈表表頭,pre為第二個多項式建立的鏈表表頭 {PLOYList *input。while(flag==0){if(prenext==NULL)flag=1。input=(PLOYList *)malloc(sizeof(PLOYList))。inputexpn=preexpn。insert(head,input)。}PLOYList *sub(PLOYList *head,PLOYList *pre)//多項式相減 {PLOYList *input。while(flag==0){if(prenext==NULL)flag=1。input=(PLOYList *)malloc(sizeof(PLOYList))。//將第二個多項式里的數(shù)變?yōu)槠湎喾磾?shù),再用和加法一樣的方法實現(xiàn)減法inputexpn=preexpn。insert(head,input)。}PLOYList *mul(PLOYList *head,PLOYList *pre)//多項式項乘 { PLOYList *hf,*pf,*qa,*qb。qb = pre next。//新創(chuàng)建一個結(jié)點,當做表頭hf next = NULL。qa。qb。pf coef = qa coef * qb coef。//指數(shù)相加pf next = NULL。} } return hf。p = head next。p expn = p expn。} return head。int flag=0。if(funnext==NULL)//若為空表,則無需輸出{printf(“0n”)。}while(flag==0){第14頁 山東科技大學(xué)學(xué)生課程設(shè)計if(printingcoef0amp。funnext!=printing)printf(“+”)。else if(printingcoef==1)printf(“”)。if(printingexpn!=0)printf(“x^%d”,printingexpn)。if(printingnext==NULL)flag=1。} printf(“n”)。printf(“用戶選擇界面n”)。printf(“ **n”)。printf(“ **n”)。printf(“ * *n”)。printf(“ **n”)。printf(“n”)。printf(“n”)。}int main(){ PLOYList *f,*g,*pf,*hf,*p。start()。sign)。case 1://多項式相加{printf(“ 你選擇的操作是多項式相加:n”)。f=creat(39。)。print(f)。g=creat(39。)。print(g)。f=add(f,g)。printf(“nn”)。}case 2://多項式相減{printf(” 你選擇的操作是多項式相減:n“)。f=creat(39。)。print(f)。g=creat(39。)。print(g)。f=sub(f,g)。”)。printf(“ 繼續(xù)請選擇相應(yīng)操作,退出請按0.”)。}case 3://多項式相乘{printf(“ 你選擇的操作是多項式相乘:n”)。f=creat(39。)。print(f)。g=creat(39。)。print(g)。pf=mul(f,g)。printf(“nn”)。break。printf(“請輸入一個一元多項式:”)。f39。printf(“這個多項式為:f(x)= ”)。printf(“求導(dǎo)結(jié)果為:F(x
點擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1