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

正文內(nèi)容

20xx數(shù)據(jù)結(jié)構課程設計(編輯修改稿)

2024-10-16 20:46 本頁面
 

【文章內(nèi)容簡介】 if(!InitMaze(maze)){printf(“n 初始化迷宮失?。?”)。exit(ERROR)。}do{printf(“n請輸入入口的坐標:”)。scanf(“%d%d”,amp。,amp。)。//輸入入口坐標if( || )printf(“n輸入錯誤,請重新輸入入口的坐標!n”)。continue。}while( || )。do{printf(“n請輸入出口的坐標:”)。//輸入出口的坐標scanf(“%d%d”,amp。,amp。)。if( || )printf(“n輸入錯誤,請重新輸入出口坐標!n”)。continue。}while( || )。if(!MazePath(maze,start,end))printf(“n不能找到一條路徑!!n”)。else PrintMaze(maze)。//輸出迷宮printf(“是否要繼續(xù)?(y/n):”)。scanf(“%s”,amp。c)。} while(c==39。y39。 || c==39。Y39。)。}。測試結(jié)果:第8頁四、山東科技大學學生課程設計課程設計2 一元多項式一、需求分析:第9頁 山東科技大學學生課程設計,其中定義一元多項式中的兩個參數(shù):系數(shù)和指數(shù)和鏈表中結(jié)點的指針域;然后一一羅列每個在主程序中用到的函數(shù),并一一實現(xiàn); 最后在主程序中主要完成用戶的輸入和相關函數(shù)的調(diào)用。二、概要設計: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)//多項式求導void print(PLOYList *fun)//輸出多項式,fun指要輸出的多項式鏈表的表頭 void start()//用戶選擇界面三、詳細設計:include include typedef struct node//定義節(jié)點類型 { float coef。//多項式的系數(shù)int expn。//多項式的指數(shù)struct node * next。//結(jié)點指針域 }PLOYList。void insert(PLOYList *head,PLOYList *input)//查找位置插入新鏈節(jié)的函數(shù),且讓輸入的多項式呈降序排列 {PLOYList *pre,*now。int signal=0。pre=head。第10頁 山東科技大學學生課程設計if(prenext==NULL){prenext=input。} //如果只有一個頭結(jié)點,則把新結(jié)點直接連在后面else {now=prenext。//如果不是只有一個頭結(jié)點,則設置now指針while(signal==0){if(inputexpn nowexpn){if(nownext==NULL){nownext=input。signal=1。}else{pre=now。now=prenext。//始終讓新輸入的數(shù)的指數(shù)與最后一個結(jié)點中的數(shù)的指數(shù)比較,小于則插在其后面}}else if(inputexpn nowexpn){inputnext=now。prenext=input。signal=1。}//若新結(jié)點中指數(shù)比最后一個結(jié)點即now中的指數(shù)大,則插入now之前else//若指數(shù)相等則需合并為一個結(jié)點,若相加后指數(shù)為0則釋放該結(jié)點{nowcoef=nowcoef+inputcoef。signal=1。free(input)。if(nowcoef==0){prenext=nownext。free(now)。}}//else } //while第11頁 山東科技大學學生課程設計}//else }//voidPLOYList *creat(char ch)//輸入多項式 {PLOYList *head,*input。float x。int y。head=(PLOYList *)malloc(sizeof(PLOYList))。//創(chuàng)建鏈表頭headnext=NULL。scanf(“%f %d”,amp。x,amp。y)。//實現(xiàn)用戶輸入的第一個項,包括其指數(shù)和系數(shù)while(x!=0){input=(PLOYList *)malloc(sizeof(PLOYList))。//創(chuàng)建新鏈節(jié)inputcoef=x。inputexpn=y。inputnext=NULL。insert(head,input)。//每輸入一項就將其排序,是的鏈表中多項式呈降序排列scanf(“%f %d”,amp。x,amp。y)。} return head。}PLOYList *add(PLOYList *head,PLOYList *pre)//多項式相加,head為第一個多項式建立的鏈表表頭,pre為第二個多項式建立的鏈表表頭 {PLOYList *input。int flag=0。while(flag==0){if(prenext==NULL)flag=1。//若該鏈表為空,則無需進行加法運算,跳出循環(huán)else{pre=prenext。input=(PLOYList *)malloc(sizeof(PLOYList))。第12頁 山東科技大學學生課程設計inputcoef=precoef。inputexpn=preexpn。inputnext=NULL。insert(head,input)。// 把g(x)插入到f(x)中,相當于兩者相加,結(jié)果保存于f(x)}} return head。}PLOYList *sub(PLOYList *head,PLOYList *pre)//多項式相減 {PLOYList *input。int flag=0。while(flag==0){if(prenext==NULL)flag=1。else{pre=prenext。input=(PLOYList *)malloc(sizeof(PLOYList))。inputcoef=0precoef。//將第二個多項式里的數(shù)變?yōu)槠湎喾磾?shù),再用和加法一樣的方法實現(xiàn)減法inputexpn=preexpn。inputnext=NULL。insert(head,input)。}} return head。}PLOYList *mul(PLOYList *head,PLOYList *pre)//多項式項乘 { PLOYList *hf,*pf,*qa,*qb。qa = head next。qb = pre next。//定義指針指向表頭后一個元素,即鏈表中第一個元素hf =(PLOYList *)malloc(sizeof(PLOYList))。//新創(chuàng)建一個結(jié)點,當做表頭hf next = NULL。for(。qa。qa = qa next)第13頁 山東科技大學學生課程設計{for(qb = pre next。qb。qb= qb next)//用兩個循環(huán),實現(xiàn)兩個多項式之間每個項相乘,結(jié)果用insert函數(shù)進行排序與合并{pf =(PLOYList *)malloc(sizeof(PLOYList))。pf coef = qa coef * qb coef。//系數(shù)相乘pf expn = qa expn + qb expn。//指數(shù)相加pf next = NULL。insert(hf,pf)。} } return hf。}PLOYList *der(PLOYList *head)//多項式求導 { PLOYList *p。p = head next。while(p){p coef = p coef * p expn。p expn = p expn。p = p next。} return head。}//將多項式的每項系數(shù)和指數(shù)相乘得到新的系數(shù),指數(shù)減一得到新的指數(shù)即完成求導void print(PLOYList *fun)//輸出多項式,fun指要輸出的多項式鏈表的表頭 {PLOYList *printing。int flag=0。printing=funnext。if(funnext==NULL)//若為空表,則無需輸出{printf(“0n”)。return。}while(flag==0){第14頁 山東科技大學學生課程設計if(printingcoef0amp。amp。funnext!=printing)printf(“+”)。if(printingcoef==1)。else if(printingcoef==1)printf(“”)。elseprintf(“%f”,printingcoef)。if(printingexpn!=0)printf(“x^%d”,printingexpn)。else if((printingcoef==1)||(printingcoef==1))printf(“1”)。if(printingnext==NULL)flag=1。elseprinting=printingnext。} printf(“n”)。}void start()//用戶選擇界面 { printf(“n”)。printf(“用戶選擇界面n”)。printf(“ ************************************n”)。printf(“ **n”)。printf(“ **n”)。printf(“ **n”)。printf(“ **n”)。printf(“ * *n”)。printf(“ **n”)。printf(“ **n”)。printf(“ ************************************n”)。printf(“n”)。printf(“ 注釋:輸入多項式格式(可無序):系數(shù)1 指數(shù)1 系數(shù)2 指數(shù)2 ??,并以0 0 結(jié)束:n”)。printf(“n”)。printf(“ 請選擇操作: ”)。}int main(){ PLOYList *f,*g,*pf,*hf,*p。第15頁 山東科技大學學生課程設計int sign=1。start()。while(sign!=0){scanf(“%d”,amp。sign)。switch(sign){case 0:break。case 1://多項式相加{printf(“ 你選擇的操作是多項式相加:n”)。printf(“ 請輸入第一個多項式f(x):”)。f=creat(39。f39。)。printf(“ 第一個多項式為:f(x)=”)。print(f)。printf(“ 請輸入第二個多項式g(x):”)。g=creat(39。g39。)。printf(“ 第二個多項式為:g(x)=”)。print(g)。printf(“ 結(jié)果為:F(x)=f(x)+g(x)=”)。f=add(f,g)。print(f)。printf(“nn”)。printf(“ 繼續(xù)請選擇相應操作。}case 2://多項式相減{printf(” 你選擇的操作是多項式相減:n“)。printf(” 請輸入第一個多項式f(x):“)。f=creat(39。f39。)。printf(” 第一個多項式為:f(x)=“)。print(f)。printf(” 請輸入第二個多項式g(x):“)。g=creat(39。g39。)。printf(” 第二個多項式為:g(x)=“)。print(g)。printf(” 結(jié)果為:F(x)=f(x)g(x)=“)。f=sub(f,g)。print(f)?!?。第16頁山東科技大學學生課程設計printf(“nn”)。printf(“ 繼續(xù)請選擇相應操作,退出請按0.”)。break。}case 3://多項式相乘{printf(“ 你選擇的操作是多項式相乘:n”)。printf(“ 請輸入第一個多項式f(x):”)。f=creat(39。f39。)。printf(“ 第一個多項式為:f(x)=”)。print(f)。printf(“ 請輸入第二個多項式g(x):”)。g=creat(39。g39。)。printf(“ 第二個多項式為:g(x)=”)。print(g)。printf(“ 結(jié)果為:F(x)=f(x)* g(x)=”)。pf=mul(f,g)。print(pf)。printf(“nn”)。printf(“ 繼續(xù)請選擇相應操作,退出請按0.”)。break。}case 4://多項式求導{printf(“您選擇的是對一個一
點擊復制文檔內(nèi)容
試題試卷相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1