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

正文內容

數(shù)據(jù)結構課程設計-五子棋[★](參考版)

2024-10-17 23:21本頁面
  

【正文】 //回復用戶選擇界面break。sign=1。f=addPloyn(f,g)。print(g)。)。g=creat(39。//輸入多項式f(x)printf(“f(x)=”)。f39。//退出case 1:{printf(“你選擇的操作是多項式相加:n”)。sign)。//設置標志menu()。}void main(){Ployn *f,*g。//如果現(xiàn)在的鏈節(jié)沒有下一個就結束elseprinting=printingnext。}else if((printingcoef==1)||(printingcoef==1))printf(“1”)。//其余情況都得打印if(printingexpn!=0)//如果指數(shù)為“0”不打印指數(shù)項{ if(printingexpn==1)printf(“x”)。//如果為“1”就不用打印系數(shù)了else if(printingcoef==1)printf(“”)。 funnext!=printing)printf(“+”)。}while(flag==0){if(printingcoef0 amp。//正在被打印的鏈節(jié)if(funnext==NULL)//如果函數(shù)為空打印0{printf(“0n”)。int flag=0。//把當前“g(x)”的鏈節(jié)插入到“y(x)”中}return res。inptnext=NULL。//創(chuàng)建新鏈節(jié)inptcoef=precoef*head1coef。}pre=prenext。}if(head1==NULL){flag=1。//當現(xiàn)在指向空時跳出循環(huán)head1=head1next。pre=head2。//創(chuàng)建鏈表頭resnext=NULL。int flag=0。}//否則把當前“g(x)”的鏈節(jié)插入到“y(x)”中}return head。inptnext=NULL。//創(chuàng)建新鏈節(jié)inptcoef=0precoef。//當現(xiàn)在指向空時跳出循環(huán)else{pre=prenext。int flag=0。}//否則把當前“g(x)”的鏈節(jié)插入到“y(x)”中}return head。inptnext=NULL。//創(chuàng)建新鏈節(jié)inptcoef=precoef。//當現(xiàn)在指向空時跳出循環(huán)else{pre=prenext。int flag=0。}return head。x,amp。//不然就查找位置并且插入新鏈節(jié)printf(“請輸入一元多項式%c的下一項:(以0 0 結束!)n”,ch)。inptnext=NULL。//創(chuàng)建新鏈節(jié)inptcoef=x。y)。scanf(“%f %d”,amp。//創(chuàng)建鏈表頭headnext=NULL。int y。}} } } }Ployn *creat(char ch)//輸入多項式{Ployn *head,*inpt。//與當前鏈節(jié)相等指數(shù)if(nowcoef==0){prenext=nownext。signal=1。signal=1。}}else if(inptexpnexpn)//如果發(fā)現(xiàn)比現(xiàn)在的鏈節(jié)大了就插入到這個連接的前面{inptnext=now。}else{pre=now。while(signal==0){if(inptexpnnowexpn)//當新鏈節(jié)小于現(xiàn)在的連接時向后移一個鏈節(jié){if(nownext==NULL){nownext=inpt。//pre定義為現(xiàn)在的前一個鏈節(jié)if(prenext==NULL){prenext=inpt。int signal=0。printf(“”)。printf(“”)。printf(“請選擇操作:n”)。printf(“ 兩個一元多項式的相加/相減,相乘:n”)。}Ployn。int expn。VC++。要求:能自己創(chuàng)建線性表,能自主的進行線性表的有關插入刪除操作,并且可以在此基礎上實現(xiàn)線性表之間的加減乘除運算。}}//swith}//while }//void四、測試結果:第17頁 山東科技大學學生課程設計第18頁第三篇:數(shù)據(jù)結構課程設計南京航空航天大學金城學院《數(shù)據(jù)結構》 課程設計報告題目:一元多項式的加減乘法運算班級: 20100232 學號: 2010023220 姓名: 祁博 成績:指導教師: 葉延風完成日期: 2012年 2月18 日課程設計的主要內容 需求分析用線性表實現(xiàn)一元多項式的加法減法與乘法。printf(“ 繼續(xù)請選擇相應操作,退出請按0.”)。print(f)。(x)= ”)。print(f)。)。f = creat(39。}case 4://多項式求導{printf(“您選擇的是對一個一元多項式求導:n”)。printf(“ 繼續(xù)請選擇相應操作,退出請按0.”)。print(pf)。printf(“ 結果為:F(x)=f(x)* g(x)=”)。printf(“ 第二個多項式為:g(x)=”)。g39。printf(“ 請輸入第二個多項式g(x):”)。printf(“ 第一個多項式為:f(x)=”)。f39。printf(“ 請輸入第一個多項式f(x):”)。break。第16頁山東科技大學學生課程設計printf(“nn”)。print(f)。printf(” 結果為:F(x)=f(x)g(x)=“)。printf(” 第二個多項式為:g(x)=“)。g39。printf(” 請輸入第二個多項式g(x):“)。printf(” 第一個多項式為:f(x)=“)。f39。printf(” 請輸入第一個多項式f(x):“)。printf(“ 繼續(xù)請選擇相應操作。print(f)。printf(“ 結果為:F(x)=f(x)+g(x)=”)。printf(“ 第二個多項式為:g(x)=”)。g39。printf(“ 請輸入第二個多項式g(x):”)。printf(“ 第一個多項式為:f(x)=”)。f39。printf(“ 請輸入第一個多項式f(x):”)。switch(sign){case 0:break。while(sign!=0){scanf(“%d”,amp。第15頁 山東科技大學學生課程設計int sign=1。printf(“ 請選擇操作: ”)。printf(“ 注釋:輸入多項式格式(可無序):系數(shù)1 指數(shù)1 系數(shù)2 指數(shù)2 ??,并以0 0 結束:n”)。printf(“ ************************************n”)。printf(“ **n”)。printf(“ **n”)。printf(“ **n”)。printf(“ ************************************n”)。}void start()//用戶選擇界面 { printf(“n”)。elseprinting=printingnext。else if((printingcoef==1)||(printingcoef==1))printf(“1”)。elseprintf(“%f”,printingcoef)。if(printingcoef==1)。amp。return。printing=funnext。}//將多項式的每項系數(shù)和指數(shù)相乘得到新的系數(shù),指數(shù)減一得到新的指數(shù)即完成求導void print(PLOYList *fun)//輸出多項式,fun指要輸出的多項式鏈表的表頭 {PLOYList *printing。p = p next。while(p){p coef = p coef * p expn。}PLOYList *der(PLOYList *head)//多項式求導 { PLOYList *p。insert(hf,pf)。//系數(shù)相乘pf expn = qa expn + qb expn。qb= qb next)//用兩個循環(huán),實現(xiàn)兩個多項式之間每個項相乘,結果用insert函數(shù)進行排序與合并{pf =(PLOYList *)malloc(sizeof(PLOYList))。qa = qa next)第13頁 山東科技大學學生課程設計{for(qb = pre next。for(。//定義指針指向表頭后一個元素,即鏈表中第一個元素hf =(PLOYList *)malloc(sizeof(PLOYList))。qa = head next。}} return head。inputnext=NULL。inputcoef=0precoef。else{pre=prenext。int flag=0。// 把g(x)插入到f(x)中,相當于兩者相加,結果保存于f(x)}} return head。inputnext=NULL。第12頁 山東科技大學學生課程設計inputcoef=precoef。//若該鏈表為空,則無需進行加法運算,跳出循環(huán)else{pre=prenext。int flag=0。} return head。x,amp。insert(head,input)。inputexpn=y。//實現(xiàn)用戶輸入的第一個項,包括其指數(shù)和系數(shù)while(x!=0){input=(PLOYList *)malloc(sizeof(PLOYList))。x,amp。//創(chuàng)建鏈表頭headnext=NULL。int y。}}//else } //while第11頁 山東科技大學學生課程設計}//else }//voidPLOYList *creat(char ch)//輸入多項式 {PLOYList *head,*input。if(nowcoef==0){prenext=nownext。signal=1。signal=1。//始終讓新輸入的數(shù)的指數(shù)與最后一個結點中的數(shù)的指數(shù)比較,小于則插在其后面}}else if(inputexpn nowexpn){inputnext=now。}else{pre=now。//如果不是只有一個頭結點,則設置now指針while(signal==0){if(inputexpn nowexpn){if(nownext==NULL){nownext=input。第10頁 山東科技大學學生課程設計if(prenext==NULL){prenext=input。int signal=0。//結點指針域 }PLOYList。//多項式的系數(shù)int expn。測試結果:第8頁四、山東科技大學學生課程設計課程設計2 一元多項式一、需求分析:第9頁 山東科技大學學生課程設計,其中定義一元多項式中的兩個參數(shù):系數(shù)和指數(shù)和鏈表中結點的指針域;然后一一羅列每個在主程序中用到的函數(shù),并一一實現(xiàn); 最后在主程序中主要完成用戶的輸入和相關函數(shù)的調用。)。 || c==39。} while(c==39。scanf(“%s”,amp。else PrintMaze(maze)。}while( || )。if( || )printf(“n輸入錯誤,請重新輸入出口坐標!n”)。,amp。do{printf(“n請輸入出口的坐標:”)。continue。)。scanf(“%d%d”,amp。exit(ERROR)。第7頁 山東科技大學學生課程設計do {printf(“**********迷宮求解**********n”)。PostType start,end。else return FALSE。}}//if} }while(!StackEmpty(S))。Push(S,e)。Pop(S,e)。amp。//探索下一步}}//ifelse//當前位置不能通過{if(!StackEmpty(S)){Pop(S,e)。}else{curpos=NextPos(curpos,1)。 ==)//到達出口返回TRUE{第6頁 山東科技大學學生課程設計if(!DestroyStack(S))exit(OVERFLOW)。//加入棧路徑中if(== amp。=1。=curstep。curstep=1。InitStack(S)。int curstep。maze,PostType start,PostType end)//若迷宮從入口start到end的通道則求得一條存放在棧中 { Stack S。//輸出迷宮printf(“n”)。//輸出行數(shù)for(j=0。for(i=0。iprintf(“%4d”,i)。printf(“n輸出迷宮的路徑:n”)。}//MarkPrintvoid PrintMaze(MazeType amp。39。}//NextposStatus MarkPrint(MazeType amp。default: exit(ERROR)。case 4 : =1。case 3 : =1。case 2 : +=1。switch(i){//,南,西,北方向case 1 : +=1。curpos,int i){ //指示并返回下一位置的坐標PostType cpos。//“*”表示可通return OK。maze,PostType curpos){
點擊復制文檔內容
環(huán)評公示相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1