欧美色欧美亚洲高清在线观看,国产特黄特色a级在线视频,国产一区视频一区欧美,亚洲成a 人在线观看中文

  1. <ul id="fwlom"></ul>

    <object id="fwlom"></object>

    <span id="fwlom"></span><dfn id="fwlom"></dfn>

      <object id="fwlom"></object>

      軟件技術(shù)實(shí)驗(yàn)報(bào)告[五篇模版]

      時(shí)間:2020-11-26 12:42:29下載本文作者:會(huì)員上傳
      簡(jiǎn)介:寫寫幫文庫(kù)小編為你整理了多篇相關(guān)的《軟件技術(shù)實(shí)驗(yàn)報(bào)告》,但愿對(duì)你工作學(xué)習(xí)有幫助,當(dāng)然你在寫寫幫文庫(kù)還可以找到更多《軟件技術(shù)實(shí)驗(yàn)報(bào)告》。

      第一篇:軟件技術(shù)實(shí)驗(yàn)報(bào)告

      軟件技術(shù)實(shí)驗(yàn)報(bào)告

      實(shí)驗(yàn)序號(hào)

      名稱

      B VB 的感性認(rèn)識(shí)--B VB 基本控件

      班級(jí)

      學(xué)號(hào)

      姓名

      實(shí)驗(yàn)內(nèi)容及完成情況:

      實(shí)驗(yàn)內(nèi)容:1)

      在屏幕上開(kāi)辟一個(gè)窗口(文本框),窗口的上部放置一個(gè)標(biāo)簽,標(biāo)簽中顯示:“歡迎使用 0 Visual Basic6.0 中文版”。窗口的下部有三個(gè)按鈕,左邊按鈕中標(biāo)有“開(kāi)始顯示”,中間按鈕中標(biāo)有“清屏”,右邊按鈕中標(biāo)有“結(jié)束”。當(dāng)鼠標(biāo)單擊左邊按鈕時(shí),文本框中顯示“欲窮千里目,更上一層樓!”如果單擊中間按鈕,則清除文本框中顯示的內(nèi)容,單擊右邊按鈕則程序結(jié)束。2)單擊“清屏”后,讓光標(biāo)出 現(xiàn)在文本框中,此時(shí)往文本框中輸入若干文字,例如“您好”,然后單擊窗體,使得在窗體的指定位置上顯示在文本框中輸入的文字。3)如果將 1 1)中單擊左邊按鈕后文本框中顯示的“欲窮千里目,更上一層樓!”改為“白日依山盡,黃河入海流,欲窮千里目,更上一層樓!”此時(shí)文本框在一行中將顯示不下所有文本,請(qǐng)?jiān)囌{(diào)整該文本框的“ Multiline ”屬性,并將文本框縱向距離調(diào)整到可容納兩行以上文字。此時(shí)再次執(zhí)行程序,觀察執(zhí)行結(jié)果所發(fā)生的變化。

      完成情況:順利完成。

      實(shí)驗(yàn)中遇到的問(wèn)題及解決方法:

      實(shí)驗(yàn)中所涉及的知識(shí)及技術(shù):

      文本框的雙向作用(即輸入與輸出);窗體的雙重作用(容器與輸出);事件過(guò)程的編寫;輸入輸出的簡(jiǎn)單實(shí)現(xiàn);窗體、文本框、標(biāo)簽、命令按鈕等基本控件的常用屬性的動(dòng)、靜態(tài)設(shè)置等。

      實(shí)驗(yàn)中的創(chuàng)新及功能擴(kuò)充:

      實(shí)驗(yàn)收獲與體會(huì):

      備注:

      第二篇:軟件技術(shù)基礎(chǔ)實(shí)驗(yàn)報(bào)告

      《軟件開(kāi)發(fā)技術(shù)基礎(chǔ)》

      實(shí)驗(yàn)報(bào)告

      學(xué)院:XX學(xué)院

      班級(jí):XX

      姓名: XX

      學(xué)號(hào):XX

      《軟件開(kāi)發(fā)技術(shù)基礎(chǔ)》實(shí)驗(yàn)報(bào)告

      實(shí)驗(yàn)名稱:實(shí)驗(yàn)一 順序表的操作

      班 級(jí) 學(xué) 號(hào) 姓 名 第 周 星 期 節(jié) 成 績(jī)

      一、實(shí)驗(yàn)?zāi)康模?/p>

      1、掌握順序表結(jié)構(gòu)的實(shí)現(xiàn)方式;

      2、掌握順序表常用算法的實(shí)現(xiàn);

      3、熟悉利用順序表解決問(wèn)題的一般思路;

      4、參照給定的順序表的程序樣例,驗(yàn)證給出的順序表的常見(jiàn)算法,領(lǐng)會(huì)順序表結(jié)構(gòu)的優(yōu)點(diǎn)和不足。

      二、實(shí)驗(yàn)要求:

      1、掌握順序表的特點(diǎn)及常見(jiàn)算法。

      2、提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。

      三、實(shí)驗(yàn)內(nèi)容:

      1、設(shè)計(jì)一個(gè)靜態(tài)數(shù)組存儲(chǔ)結(jié)構(gòu)的順序表,要求編程實(shí)現(xiàn)如下任務(wù):

      (1)建立一個(gè)順序表,首先依次輸人整數(shù)數(shù)據(jù)元素(個(gè)數(shù)根據(jù)需要鍵盤給定)。(2)刪除指定位置的數(shù)據(jù)元素(指定元素位置通過(guò)鍵盤輸入),再依次顯示刪除后的順序表中的數(shù)據(jù)元素。

      (3)查找指定數(shù)據(jù)的數(shù)據(jù)元素(指定數(shù)據(jù)由鍵盤輸入),若找到則顯示位置,若沒(méi)有找到則顯示0。

      2、使用順序表實(shí)現(xiàn)一個(gè)電話本的管理程序,電話本中的每條記錄包括學(xué)號(hào)、姓名、手機(jī)號(hào)碼和固定電話四項(xiàng)。要求實(shí)現(xiàn)菜單、初始化、添加、刪除和顯示等功能。

      四、程序要求:

      1、采用順序表實(shí)現(xiàn),假設(shè)該順序表的數(shù)據(jù)元素個(gè)數(shù)在最壞情況下不會(huì)超過(guò)50個(gè)。

      2、寫出完整的程序并能調(diào)試運(yùn)行。

      五、實(shí)驗(yàn)結(jié)果:

      1、順序表的結(jié)果:

      2、電話簿的結(jié)果:

      六、實(shí)驗(yàn)中遇到的問(wèn)題及解決方法:

      1.在刪除數(shù)據(jù)的時(shí)候如果有兩個(gè)一樣的數(shù)時(shí)要怎樣解決? 解決方法:用while進(jìn)行判斷。

      2.在刪除操作中,刪除函數(shù)中的l是指針,所以用->指向,而在主函數(shù)中l(wèi)是結(jié)構(gòu)體,用“.”。3.在查找的時(shí)候有一個(gè)返回值,而這個(gè)返回值是指針,所以在寫查找函數(shù)的時(shí)候要把返回值類型寫上。

      七、實(shí)驗(yàn)心得體會(huì):

      一開(kāi)始不知所措,首先應(yīng)該有一個(gè)大的方向,把主程序編號(hào),再逐步求精,落實(shí)到每一個(gè)函數(shù)的編寫。對(duì)于c語(yǔ)言要熟練掌握,要熟悉循環(huán)等得操作,要熟練掌握順序表中的插入,刪除,查找,的基本函數(shù)。在此的基礎(chǔ)上靈活使用。附:

      1、順序表的程序: #include #include #include #include #define MAXSIZE 50

      struct Seqlist {

      };Seqlist *init(){

      } void insert(Seqlist *p){

      int num=0;printf(“請(qǐng)輸入要鍵入的個(gè)數(shù):”);scanf(“%d”,&num);if(num<1)printf(“鍵入的數(shù)據(jù)個(gè)數(shù)錯(cuò)誤!n”);Seqlist *p;p=(Seqlist *)malloc(sizeof(Seqlist));p->length=0;return p;int data[MAXSIZE];int length;else {

      printf(“鍵入數(shù)據(jù)為:n”);for(;num>0;num--){ p->length++;scanf(“%d”,p->data+p->length-1);

      }

      }

      } if(p->length==MAXSIZE){

      } printf(“數(shù)組已滿n”);break;getchar();void deletee(Seqlist *p){

      } int find(Seqlist *p){ int i=0;printf(“請(qǐng)輸入要?jiǎng)h除元素的位置:”);scanf(“%d”,&i);if(i<1||i>p->length)printf(“表中沒(méi)有第%d個(gè)元素!n”,i);else {

      } getchar();for(int j=i;j<=p->length-1;j++)p->data[j-1]=p->data[j];p->length--;

      } int x;printf(“請(qǐng)輸入要查找的數(shù)據(jù):”);scanf(“%d”,&x);for(int i=0;i

      length;i++){

      } if(i>=p->length)printf(“數(shù)組中沒(méi)有此數(shù)據(jù)!n”);if(p->data[i]==x){

      } printf(“此數(shù)據(jù)位于第%d個(gè)位置n”,i+1);return i+1;getchar();return 0;void display(Seqlist *p){

      } int main(void){ Seqlist *p;for(int i=0;i

      length;i++)printf(“%-5d”,p->data[i]);putchar('n');getchar();

      p=init();char flag;printf(“1-插入 2-刪除 3-查找 4-顯示 0-退出n”);while(1){

      printf(“請(qǐng)輸入操作:”);switch(flag=getchar()){ case '1':insert(p);putchar('n');break;case '2':deletee(p);printf(“刪除后數(shù)據(jù)為:”);display(p);putchar('n');getchar();break;case '3':find(p);putchar('n');getchar();break;case '4':printf(“顯示數(shù)據(jù)為:”);display(p);putchar('n');break;case '0':free(p);return 0;}

      }

      }

      2、電話簿的程序: #include #include #include #include using namespace std;typedef struct contact {

      string name;string phonenumber;string phone;contact *next;}CNT;class Phonebook { public:

      Phonebook();CNT *Input();CNT *Turn_to_end();void Add();void Delete();void Showmenu();CNT *Find();void Show_item(CNT *p);void Display();void Modification();private: };

      Phonebook::Phonebook(){ head=new CNT;CNT *head;

      } head->next=NULL;void Phonebook::Show_item(CNT *p){ cout<<“|----姓名----|--電話號(hào)碼--|-------------地址------------|”<name<<'|'<phonenumber<<'|'<phone<<'|'<

      }

      void Phonebook::Display(){

      CNT *p;cout<<“|----姓名----|--電話號(hào)碼--|-------------地址------------|”<next;p!=NULL;p=p->next)cout<<'|'<name<<'|'<phonenumber<<'|'<phone<<'|'<

      }

      cout<<“|------------------------|”<

      CNT *Phonebook::Input(){

      }

      CNT *Phonebook::Turn_to_end(){

      } CNT *temp=head;while(temp->next!=NULL){ } cout<<“n”;return temp;temp=temp->next;CNT *temp;temp=new CNT;cout<<“請(qǐng)輸入姓名:”;cin>>temp->name;cout<<“請(qǐng)輸入手機(jī)號(hào)碼:”;cin>>temp->phonenumber;cout<<“請(qǐng)輸入固定電話:”;cin>>temp->phone;temp->next=NULL;cout<<“n”;return temp;

      void Phonebook::Add(){

      }

      void Phonebook::Delete(){

      CNT *p,*q;q=p=head;string data;cout<<“請(qǐng)輸入要?jiǎng)h除聯(lián)系人的信息:”;cin>>data;for(p=p->next;p!=NULL&&p->name!=data&&p->phonenumber!=data&&p->phone!=data;CNT *temp,*p;temp=Input();p=Turn_to_end();p->next=temp;cout<<“n”;p=p->next)

      q=p;if(p!=NULL){ q->next=p->next;delete p;

      } } else cout<<“該信息不存在”<

      }

      CNT *Phonebook::Find(){

      CNT *p=head;string data;cout<<“請(qǐng)輸入要查找或要修改的聯(lián)系人的信息:”;cin>>data;for(p=p->next;p!=NULL&&p->name!=data&&p->phonenumber!=data&&p->phone!=data;cout<<“ 電話簿”<next);

      if(p!=NULL)Show_item(p);else

      } cout<<“不存在該信息”<

      }

      int main(){ int select;Phonebook phbook;CNT *p;p=Find();if(p!=NULL){

      } cout<<“n”;cout<<“請(qǐng)輸入姓名:”;cin>>p->name;cout<<“請(qǐng)輸入手機(jī)號(hào)碼:”;cin>>p->phonenumber;cout<<“請(qǐng)輸入固定電話:”;cin>>p->phone;

      phbook.Showmenu();while(1){

      cout<<“n請(qǐng)輸入要選擇的操作(0~6):”;cin>>select;getchar();switch(select){ case 0: exit(0);break;case 1: phbook.Add();break;case 2: phbook.Display();break;case 3: phbook.Delete();break;case 4: phbook.Find();break;case 5: phbook.Modification();break;

      } } } return 0;

      實(shí)驗(yàn)名稱:實(shí)驗(yàn)二 鏈表的操作

      (一)班 級(jí) 學(xué) 號(hào) 姓 名 第 周 星 期

      節(jié) 成 績(jī)

      一、實(shí)驗(yàn)?zāi)康模?/p>

      1、掌握單鏈表結(jié)構(gòu)的實(shí)現(xiàn)方式;

      2、掌握單鏈表常用算法的實(shí)現(xiàn)。

      二、實(shí)驗(yàn)要求:

      1、掌握鏈表的特點(diǎn)及常見(jiàn)算法。

      2、提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。

      三、實(shí)驗(yàn)內(nèi)容:

      1、設(shè)計(jì)一個(gè)鏈表,要求編程實(shí)現(xiàn)如下任務(wù):

      (1)建立一個(gè)鏈表,首先依次輸人整數(shù)數(shù)據(jù)元素(個(gè)數(shù)根據(jù)需要鍵盤給定)。(2)刪除指定值的結(jié)點(diǎn)(指定值通過(guò)鍵盤輸入),再依次顯示刪除后的鏈表中的數(shù)據(jù)元素。

      (3)查找指定值的結(jié)點(diǎn)(指定數(shù)據(jù)由鍵盤輸入),若找到則顯示查找成功,若沒(méi)有找到則顯示查找失敗。

      (4)在第i個(gè)節(jié)點(diǎn)(i由鍵盤輸入,i=0表示插入的結(jié)點(diǎn)作為第1個(gè)結(jié)點(diǎn))之后插入一個(gè)元素為x的節(jié)點(diǎn)。

      四、程序要求:

      1、采用鏈表實(shí)現(xiàn),假設(shè)該鏈表的結(jié)點(diǎn)數(shù)在最壞情況下不會(huì)超過(guò)40個(gè)。

      2、寫出完整的程序并能調(diào)試運(yùn)行。

      五、實(shí)驗(yàn)結(jié)果:

      六、實(shí)驗(yàn)中遇到的問(wèn)題及解決方法: 問(wèn)題:在查找數(shù)據(jù)時(shí)顯示的是一樣的?

      解決方法:在查找函數(shù)前要標(biāo)明返回值的類型lnode *find。

      七、實(shí)驗(yàn)心得體會(huì):

      首先要把書(shū)上的關(guān)于單鏈表的定義理解,在這個(gè)的基礎(chǔ)上使用它。單鏈表通過(guò)結(jié)點(diǎn)在數(shù)據(jù)后附加后繼元素的指針信息,可以更靈活的添加,刪除,查找,插入,元素。要清楚指針的指向。首先要定義一個(gè)頭結(jié)點(diǎn),并且指針域要為空。將各個(gè)操作分別編寫函數(shù),有利于分塊使用而且可以多次使用。附:

      #include int a[50],leng=0;void delet();void chazhao();void main()

      { cout<<“請(qǐng)輸入數(shù)組的個(gè)數(shù)(小于50):”;cin>>leng;cout<<“請(qǐng)輸入數(shù)據(jù):”;for(int i=0;i>a[i];int y;cout<<“n”;do { cout<<“請(qǐng)選擇:1-刪除 2-查找 0 退出”<>y;if(y==1)delet();cout<<“n”;if(y==2)chazhao();cout<<“n”;} void delet(){ cout<<“請(qǐng)輸入刪除的數(shù)的位置: ”;}while(y!=0);int i;cin>>i;if(i>=leng){ cout<<“數(shù)組的的長(zhǎng)度小于你刪除的位置”<

      } for(int j=i;j>temp;for(int i=0;i

      {

      if(a[i]==temp){ x=i+1;cout<<“你要查找的數(shù)是數(shù)組的第”<

      } } if(x==0)cout<<“數(shù)組中沒(méi)有你要查找的數(shù)”;}

      實(shí)驗(yàn)名稱:實(shí)驗(yàn)三 鏈表的操作

      (二)班 級(jí) 學(xué) 號(hào) 姓 名 第 周 星 期

      節(jié) 成 績(jī)

      一、實(shí)驗(yàn)?zāi)康模?/p>

      1、熟悉利用線性鏈表解決問(wèn)題的一般思路;

      2、參照給定的鏈表的程序樣例,驗(yàn)證給出的鏈表的常見(jiàn)算法,了解單鏈表結(jié)構(gòu)的優(yōu)點(diǎn)和不足。

      二、實(shí)驗(yàn)要求:

      1、熟練掌握鏈表的使用,并能運(yùn)用其解決些常規(guī)問(wèn)題。

      2、提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。

      三、實(shí)驗(yàn)內(nèi)容:

      1、使用鏈表實(shí)現(xiàn)一個(gè)電話本的管理程序,電話本中的每條記錄包括姓名和電話兩項(xiàng)。要求實(shí)現(xiàn)菜單、初始化、添加、刪除和顯示等功能。

      四、程序要求:

      1、采用鏈表實(shí)現(xiàn),假設(shè)該鏈表的結(jié)點(diǎn)數(shù)在最壞情況下不會(huì)超過(guò)40個(gè)。

      2、寫出完整的程序并能調(diào)試運(yùn)行。

      五、實(shí)驗(yàn)結(jié)果:

      六、實(shí)驗(yàn)中遇到的問(wèn)題及解決方法: 1.實(shí)驗(yàn)結(jié)果版面不好看

      解決方法:反復(fù)調(diào)試執(zhí)行,每次都對(duì)自己不滿意的地方進(jìn)行一些改正。2.怎樣比較name與s->name?

      解決方法:用string.h中的strcmp函數(shù)。3.在傳遞數(shù)據(jù)時(shí)有問(wèn)題?

      解決方法:返回的值要注意數(shù)據(jù)類型,是指針還是整數(shù)等。

      七、實(shí)驗(yàn)心得體會(huì):

      在應(yīng)用中可以利用while實(shí)現(xiàn)選擇,并根據(jù)選擇用switch來(lái)完成選擇。為了簡(jiǎn)化編程,結(jié)點(diǎn)插入操作可僅僅在頭部進(jìn)行。單鏈表的方法使添加操作更加簡(jiǎn)便。不需要事先分配結(jié)點(diǎn)空間,而是在需要時(shí)動(dòng)態(tài)的申請(qǐng),節(jié)省了空間。、附:

      #include #include #include #include typedef struct Student { char stu_number[12];char stu_name[12];char stu_phone[12];struct Student *next;}STU;

      void show_menu(){ puts(“1添加 2刪除 3查找 4插入 5顯示 0退出”);}

      void show_item(STU *p){ printf(“|編號(hào)| 學(xué)號(hào) | 姓名 | 電話號(hào)碼 |n”);printf(“|1 |%-12s|%-12s|%-12s|n”,p->stu_number,p->stu_name,p->stu_phone);

      }

      STU *init(){ STU *p;p=(STU *)malloc(sizeof(STU));p->next=NULL;return p;}

      void display(STU *head){ int i;STU *p;p=head->next;printf(“|編號(hào)| 學(xué)號(hào) | 姓名 | 電話號(hào)碼 |n”);for(i=1;p!=NULL;i++,p=p->next){

      printf(“|%-4d|%-12s|%-12s|%-12s|n”,i,p->stu_number,p->stu_name,p->stu_phone);} }

      STU *turn_to_end(STU *head){ STU *p;for(p=head;p->next!=NULL;p=p->next);return p;}

      STU *putin(){ STU *temp;temp=(STU *)malloc(sizeof(STU));printf(“請(qǐng)輸入姓名:”);gets(temp->stu_name);printf(“請(qǐng)輸入學(xué)號(hào):”);gets(temp->stu_number);printf(“請(qǐng)輸入電話號(hào)碼:”);gets(temp->stu_phone);temp->next=NULL;return temp;}

      void add(STU *head){ STU *temp,*p;p=head;temp=putin();p=turn_to_end(head);p->next=temp;}

      STU *find(STU *head,int i){ STU *p;if(i<1)

      puts(“輸入錯(cuò)誤”);else {

      for(p=head;p->next!=NULL&&i>0;i--,p=p->next);

      if(i>0)

      {

      puts(“不存在該結(jié)點(diǎn)”);

      return NULL;

      } } return p;} STU *find_stu(STU *head,char *data){ STU *p,*q;q=p=head;for(p=head->next;p!=NULL&&strcmp(p->stu_name,data)!=0&&strcmp(p->stu_number,data)!=0&&strcmp(p->stu_phone,data)!=0;p=p->next)

      q=p;if(p!=NULL)

      return q;else {

      puts(“不存在該信息”);

      return p;} } void delet(STU *head,char *data){ STU *p,*q;p=q=head;q=find_stu(head,data);if(q!=NULL){

      p=q->next;

      q->next=p->next;

      free(p);} } void insert(STU *head,int i)

      { STU *p,*q,*temp;q=p=head;if(i<0)

      puts(“輸入錯(cuò)誤”);else if(i==0){

      temp=putin();

      temp->next=p->next;

      q->next=temp;

      } else if(find(head,i)!=NULL){

      q=find(head,i);

      p=q->next;

      temp=putin();

      q->next=temp;

      temp->next=p;} else

      return;}

      int main(void){ STU *head,*temp;int selct,node;char data[12];head=init();show_menu();while(1){

      printf(“請(qǐng)選擇操作:”);

      scanf(“%d”,&selct);

      getchar();

      switch(selct)

      {

      case 1:

      add(head);

      putchar('n');

      break;

      case 2:

      display(head);

      printf(“請(qǐng)輸入要?jiǎng)h除學(xué)生的學(xué)號(hào)、姓名或電話號(hào)碼:”);

      }

      scanf(“%s”,data);

      getchar();

      delet(head,data);

      display(head);

      putchar('n');

      break;case 3:

      puts(“請(qǐng)輸入要查找的數(shù)據(jù)”);

      scanf(“%s”,data);

      getchar();

      if(temp=find_stu(head,data))

      {

      show_item(temp->next);

      }

      else

      puts(“ 不存在該信息”);

      putchar('n');

      break;case 4:

      puts(“請(qǐng)輸入要插入結(jié)點(diǎn)的位置”);

      scanf(“%d”,&node);

      getchar();

      insert(head,node);

      putchar('n');

      break;case 5:

      display(head);

      putchar('n');

      break;case 0:

      exit(0);

      break;} } return 0;

      實(shí)驗(yàn)名稱:實(shí)驗(yàn)四 棧的操作

      班 級(jí) 學(xué) 號(hào) 姓 名 第 周 星 期 節(jié)

      成 績(jī)

      一、實(shí)驗(yàn)?zāi)康模?/p>

      掌握棧的的定義和運(yùn)算,了解棧的應(yīng)用。

      二、實(shí)驗(yàn)要求:

      1、掌握棧的特點(diǎn)及常見(jiàn)算法。

      2、參照給定的棧的程序樣例,驗(yàn)證給出的棧的常見(jiàn)算法。

      3、提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。

      三、實(shí)驗(yàn)內(nèi)容:

      1、堆棧的測(cè)試和應(yīng)用。要求:

      設(shè)計(jì)一個(gè)主函數(shù)實(shí)現(xiàn)對(duì)順序堆棧代碼進(jìn)行測(cè)試。測(cè)試方法為:依次把數(shù)據(jù)元素1,3,5,7,9入棧,然后出棧堆棧中的數(shù)據(jù)元素并在屏幕上顯示。

      四、程序要求:

      1、棧的長(zhǎng)度自行確定。

      2、重點(diǎn)理解棧的算法思想,能夠根據(jù)實(shí)際情況選擇合適的存儲(chǔ)結(jié)構(gòu)。

      3、寫出完整的程序并能調(diào)試通過(guò)。

      五、實(shí)驗(yàn)結(jié)果:

      六、實(shí)驗(yàn)中遇到的問(wèn)題及解決方法:

      七、實(shí)驗(yàn)心得體會(huì):

      棧是后進(jìn)先出表,只允許在棧頂進(jìn)行插入和刪除。要掌握順序棧初始化,出棧,入棧的基本程序,在理解得基礎(chǔ)上加以運(yùn)用。要清楚棧和單鏈表的區(qū)別。附:

      #include #include using namespace std;class Sqstack { private: int *data;int top;int maxsize;public: Sqstack();void push();void pop(int &);void display();void modify();};Sqstack::Sqstack(){ top=-1;maxsize=5;data=new int[maxsize];}

      void Sqstack::push(){ int temp;if(top>=maxsize-1){

      cout<<“堆棧已滿”<

      cout<<“請(qǐng)輸入要進(jìn)棧數(shù)的值”<

      cin>>temp;

      top++;

      *(data+top)=temp;}

      }

      void Sqstack::pop(int &e){ if(top>-1){

      e=*(data+top);

      top--;

      cout<

      cout<<“堆棧已空”;} cout<-1){

      i=top;

      for(;i>=0;i--)

      cout<<*(data+i)<<“ ”;} else

      cout<<“空?!?cout<

      void Sqstack::modify(){ int temp;cout<<“請(qǐng)輸入棧的長(zhǎng)度”<>temp;if(temp>0)

      maxsize=temp;else

      cout<<“輸入錯(cuò)誤棧的長(zhǎng)度必須>0”<

      int main(){ Sqstack test;int temp,select;cout<<“1.進(jìn)棧 2.出棧 3.顯示 4修改棧長(zhǎng)度 0.退出”<

      cout<<“請(qǐng)選擇操作:”;

      cin>>select;

      switch(select)

      {

      case 1:

      test.push();

      break;

      case 2:

      test.pop(temp);

      break;

      case 3:

      test.display();

      break;

      case 4:

      test.modify();

      break;

      case 0:

      exit(0);

      break;

      default:

      cout<<“輸入錯(cuò)誤按任意鍵重新輸入”<

      getch();

      break;

      } } return 0;}

      實(shí)驗(yàn)名稱:實(shí)驗(yàn)五 隊(duì)列的操作

      班 級(jí) 學(xué) 號(hào) 姓 名 第 周 星 期 節(jié)

      成 績(jī)

      一、實(shí)驗(yàn)?zāi)康模?/p>

      掌握隊(duì)列的定義及其運(yùn)算,了解隊(duì)列的應(yīng)用。

      二、實(shí)驗(yàn)要求:

      1、掌握隊(duì)列的特點(diǎn)及常見(jiàn)算法。

      2、參照給定的隊(duì)列的程序樣例,驗(yàn)證給出的隊(duì)列的常見(jiàn)算法。

      3、提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。

      三、實(shí)驗(yàn)內(nèi)容:

      1、隊(duì)列測(cè)試和應(yīng)用。要求:

      設(shè)計(jì)一個(gè)主函數(shù)對(duì)循環(huán)隊(duì)列代碼進(jìn)行測(cè)試。測(cè)試方法為:依次把數(shù)據(jù)元素2,4,6,8,10入隊(duì),然后出隊(duì)中的數(shù)據(jù)元素并在屏幕上顯示。

      四、程序要求:

      1、隊(duì)列的長(zhǎng)度由自行確定。

      2、重點(diǎn)理解隊(duì)列的算法思想,能夠根據(jù)實(shí)際情況選擇合適的存儲(chǔ)結(jié)構(gòu)。

      3、寫出完整的程序并能調(diào)試通過(guò)。

      五、實(shí)驗(yàn)結(jié)果

      六、實(shí)驗(yàn)中遇到的問(wèn)題及解決方法:

      七、實(shí)驗(yàn)心得體會(huì):

      隊(duì)列是只允許在一端進(jìn)行刪除操作的線性表。在操作時(shí)會(huì)有假溢出的情況出現(xiàn),可以將存放隊(duì)列元素的數(shù)組守衛(wèi)相接,形成循環(huán)隊(duì)列。即:rear=(rear+1)%m;Front=(front+1)%m 附:

      #include #include using namespace std;

      typedef struct Temp {

      int data;

      struct Temp *next;}T;class Linksqueue { private: T *front,*rear;public: Linksqueue();void Enqueue();void Dequeue(T *);void display();};

      Linksqueue::Linksqueue(){ front=rear=new(T);front->next=NULL;}

      void Linksqueue::Enqueue(){ T *temp;temp=new(T);cout<<“請(qǐng)輸入入隊(duì)元素的值:”<>temp->data;temp->next=NULL;rear->next=temp;rear=temp;}

      void Linksqueue::Dequeue(T *s){ T *temp;if(front->next!=NULL){

      temp=front;

      front=front->next;

      *s=*front;

      cout<<“出隊(duì)元素的值:n”<data<

      delete temp;}

      else

      cout<<“隊(duì)列已空”<

      void Linksqueue::display(){ T *temp;if(front==rear)

      cout<<“空隊(duì)”<

      cout<<“隊(duì)列所有元素為 front-> ”;

      for(temp=front->next;temp->next!=NULL;temp=temp->next)

      {

      cout<data<<“t”;

      }

      cout<data;

      cout<<“->rear”<

      int main(){ Linksqueue temp;T * a;a=new(T);int select;cout<<“1入隊(duì) 2出隊(duì) 3顯示 0退出”<

      cout<<“請(qǐng)選擇操作:”;

      cin>>select;

      switch(select)

      {

      case 1:

      temp.Enqueue();

      break;

      case 2:

      temp.Dequeue(a);

      break;

      case 3:

      temp.display();

      break;

      case 0:

      }

      exit(0);

      break;default:

      cout<<“輸入錯(cuò)誤按任意鍵重新輸入”<

      getch();

      break;} } return 0;

      實(shí)驗(yàn)名稱:實(shí)驗(yàn)六 二叉樹(shù)的生成與遍歷

      班 級(jí) 學(xué) 號(hào) 姓 名 第 周 星 期

      節(jié) 成 績(jī)

      一、實(shí)驗(yàn)?zāi)康模?/p>

      1、熟悉二叉樹(shù)節(jié)點(diǎn)的定義和生成方式;

      2、熟悉二叉樹(shù)鏈?zhǔn)浇Y(jié)構(gòu)的生成方式;

      3、掌握二叉樹(shù)遍歷算法的實(shí)現(xiàn)。

      二、實(shí)驗(yàn)要求:

      1、掌握二叉樹(shù)的常見(jiàn)算法。

      2、參照給定的二叉樹(shù)的程序樣例,驗(yàn)證給出的有關(guān)二叉樹(shù)的常見(jiàn)算法,并實(shí)現(xiàn)有關(guān)的操作。

      3、提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。

      三、實(shí)驗(yàn)內(nèi)容:

      1.設(shè)計(jì)實(shí)現(xiàn)二叉樹(shù)的建立及遍歷算法,要求:

      (1)編寫創(chuàng)建二叉鏈?zhǔn)酱鎯?chǔ)結(jié)構(gòu)的二叉樹(shù)程序并輸出。(2)編寫遞歸實(shí)現(xiàn)二叉樹(shù)的先序、中序、后序遍歷算法。

      (3)編寫主函數(shù)測(cè)試以上二叉樹(shù)的創(chuàng)建和遍歷函數(shù)。2.假設(shè)二叉樹(shù)采用鏈?zhǔn)酱鎯?chǔ)結(jié)構(gòu)進(jìn)行存儲(chǔ),編寫程序?qū)崿F(xiàn)二叉樹(shù)的所有葉子結(jié)點(diǎn)的統(tǒng)計(jì)并輸出統(tǒng)計(jì)個(gè)數(shù)。

      四、實(shí)驗(yàn)結(jié)果:

      五、實(shí)驗(yàn)中遇到的問(wèn)題及解決方法:

      調(diào)試的時(shí)候顯示沒(méi)有錯(cuò)誤但是程序運(yùn)行不出來(lái)? 在if語(yǔ)句中的相等要用“==”。要注意?。?/p>

      六、實(shí)驗(yàn)心得體會(huì):

      二叉樹(shù)的遍歷有先序,中序,后序遍歷。這三種遍歷都是用遞歸的形式實(shí)現(xiàn)的。而二叉樹(shù)的插入結(jié)點(diǎn)的算法與許多因素有關(guān),我們要在理解二叉樹(shù)結(jié)構(gòu)的基礎(chǔ)上根據(jù)需要來(lái)編寫程序。我在實(shí)驗(yàn)中使用的二叉排序樹(shù)可以作為靜態(tài)查找表使用也可以作為動(dòng)態(tài)查找表。附:

      #include #include #include #define maxsize 1024 typedef char datatype;typedef struct node { datatype data;struct node *lchild, *rchild;}bitree;bitree *CREATREE()//建立二叉樹(shù)函數(shù),函數(shù)返回值指向根節(jié)點(diǎn)指針 { char ch;bitree *Q[maxsize];int front,rear;bitree *root,*s;root=NULL;

      front=1;rear=0;printf(“請(qǐng)輸入二叉樹(shù)的各節(jié)點(diǎn),@表示虛節(jié)點(diǎn),#表示節(jié)點(diǎn):n”);scanf(“%c”,&ch);while(ch!='#'){

      putchar(ch);

      s=NULL;

      if(ch!='@')

      {

      s=(bitree *)malloc(sizeof(bitree));s->data=ch;

      s->lchild=NULL;

      s->rchild=NULL;

      }

      rear++;

      Q[rear]=s;

      if(rear==1)root=s;

      else

      {if(s&&Q[front])

      if(rear%2==0)

      Q[front]->lchild=s;

      else Q[front]->rchild=s;

      if(rear%2==1)

      front++;

      }scanf(“%c”,&ch);} return root;} void preorder(bitree *p){ if(p!=NULL){

      printf(“%c”,p->data);

      preorder(p->lchild);

      preorder(p->rchild);} return;} void inorder(bitree *p){ if(p!=NULL){

      inorder(p->lchild);

      printf(“%c”,p->data);

      inorder(p->rchild);} return;} void postorder(bitree *p){ if(p!=NULL){

      postorder(p->lchild);

      postorder(p->rchild);

      printf(“%c”,p->data);} return;} int yzjd(bitree *t){ if(t==NULL)return(0);if(t->lchild==NULL&&t->rchild==NULL)return(1);

      return(yzjd(t->lchild)+yzjd(t->rchild));} void main(){ bitree *root;root=CREATREE();

      printf(“n先序遍歷結(jié)果如下:n”);preorder(root);printf(“n中序遍歷結(jié)果如下:n”);inorder(root);printf(“n后序遍歷結(jié)果如下:n”);postorder(root);printf(“n葉子節(jié)點(diǎn)的個(gè)數(shù)為:%dn”,yzjd(root));

      printf(“n”);} 實(shí)驗(yàn)名稱:實(shí)驗(yàn)七 查找算法實(shí)現(xiàn)

      班 級(jí) 學(xué) 號(hào) 姓 名 第 周 星 期

      節(jié) 成 績(jī)

      一、實(shí)驗(yàn)?zāi)康模?/p>

      掌握各種查找算法的特點(diǎn),測(cè)試并驗(yàn)證查找常見(jiàn)算法。

      二、實(shí)驗(yàn)要求:

      1、參照各種查找算法程序樣例,驗(yàn)證給出的查找常見(jiàn)算法。

      2、提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。

      三、實(shí)驗(yàn)內(nèi)容:

      1.建立有序表,采用折半查找實(shí)現(xiàn)某一已知的關(guān)鍵字的查找。

      2.利用折半查找算法在一個(gè)有序表中插入一個(gè)元素,并保持表的有序性。

      四、實(shí)驗(yàn)結(jié)果:

      五、實(shí)驗(yàn)中遇到的問(wèn)題及解決方法:

      六、實(shí)驗(yàn)心得體會(huì):

      本實(shí)驗(yàn)使用的是折半法查找,優(yōu)點(diǎn)是查找效率高,在編程的時(shí)候要設(shè)置low,high,mid,分別表示區(qū)間和中間位置的值。

      附:

      #include #include #include #include #define MAXSIZE 100 struct Seqlist {

      };

      Seqlist * init()int data[MAXSIZE];int length;

      {

      }

      void insert(Seqlist *p){

      int num=0;printf(“請(qǐng)輸入要鍵入的個(gè)數(shù):n”);if(num<1){

      } int temp;for(int i=1;i

      length;i++)

      for(int j=0;j

      length-i;j++)

      if(p->data[j]>p->data[j+1]){

      } temp=p->data[j];p->data[j]=p->data[j+1];p->data[j+1]=temp;printf(“請(qǐng)輸入數(shù)據(jù):n”);for(;num>0;num--){

      }

      p->length++;scanf(“%d”,p->data+p->length-1);if(p->length==MAXSIZE){

      }

      printf(“數(shù)組已滿n”);break;printf(“輸入個(gè)數(shù)有誤n”);else Seqlist *p;p=(Seqlist *)malloc(sizeof(Seqlist));p->length=0;return p;scanf(“%d”,&num);

      } getchar();int binsearch(Seqlist *p){

      } void display(Seqlist *p){

      }

      int main(void){

      Seqlist *p;char flag;p=init();int i;for(i=0;i

      length;i++)printf(“%-5d”,p->data[i]);putchar('n');getchar();int low,high,mid,key;low=0;high=p->length-1;printf(“請(qǐng)輸入要查找的數(shù)據(jù):n”);scanf(“%d”,&key);getchar();while(low<=high){

      } return 0;mid=(low+high)/2;if(key==p->data[mid]){

      } else if(key

      data[mid])high=mid-1;else low=mid+1;printf(“此數(shù)據(jù)位于第%d位置n”,mid+1);return mid+1;

      } printf(“1-插入 2-折半法查找 3-顯示 0-退出n”);while(1){

      } return 0;printf(“請(qǐng)輸入操作:”);switch(flag=getchar()){ case '1' : insert(p);break;case '2' : binsearch(p);break;case '3' : printf(“所有數(shù)據(jù)為:”);display(p);break;case '0' : free(p);return 0;} 實(shí)驗(yàn)名稱:實(shí)驗(yàn)八 排序綜合實(shí)驗(yàn)

      班 級(jí) 學(xué) 號(hào) 姓 名 第 周 星 期

      節(jié) 成 績(jī)

      一、實(shí)驗(yàn)?zāi)康模?/p>

      參照各種排序算法程序樣例,驗(yàn)證給出的排序常見(jiàn)算法。

      二、實(shí)驗(yàn)要求:

      1、掌握各種排序算法的特點(diǎn),測(cè)試并驗(yàn)證排序的常見(jiàn)算法。

      2、提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。

      三、實(shí)驗(yàn)內(nèi)容:

      輸入一組關(guān)鍵字序列分別實(shí)現(xiàn)下列排序,并將上述幾種排序的算法編寫成菜單,根據(jù)輸入的數(shù)字不同執(zhí)行對(duì)應(yīng)的排序算法(任選兩種排序方法實(shí)現(xiàn))。

      1、直接插入排序。

      2、希爾排序。

      3、冒泡排序。

      4、直接選擇排序。

      5、快速排序。

      6、堆排序。

      7、歸并排序。

      8、基數(shù)排序。

      四、實(shí)驗(yàn)結(jié)果:

      五、實(shí)驗(yàn)中遇到的問(wèn)題及解決方法: 怎樣實(shí)現(xiàn)待排序數(shù)據(jù)長(zhǎng)度從鍵盤輸入? 解決方法:設(shè)置一個(gè)n,從鍵盤輸入n的值。

      六、實(shí)驗(yàn)心得體會(huì):

      排序的常用方法有直接插入排序,簡(jiǎn)單選擇排序,冒泡排序,快速排序。我在實(shí)驗(yàn)中用了冒泡排序和快速排序,冒泡排序的程序比較簡(jiǎn)單容易理解而快速排序則比較復(fù)雜??焖倥判蛞葎澐中蛄腥缓蠼⒃趧澐只A(chǔ)上進(jìn)行排序,這個(gè)排序是由遞歸實(shí)現(xiàn)的。但是快速排序的優(yōu)點(diǎn)是排序比較快。附:

      #include #include #include #include #define MAXSIZE 100 struct Seqlist { int data[MAXSIZE];int length;};

      Seqlist * init(){

      Seqlist *p;p=(Seqlist *)malloc(sizeof(Seqlist));p->length=0;return p;} void insert(Seqlist *p){ int num=0;printf(“請(qǐng)輸入要鍵入的個(gè)數(shù):n”);scanf(“%d”,&num);if(num<1)

      printf(“輸入個(gè)數(shù)有誤n”);else{

      printf(“請(qǐng)輸入數(shù)據(jù):n”);

      for(;num>0;num--)

      {

      p->length++;

      scanf(“%d”,p->data+p->length-1);

      if(p->length==MAXSIZE)

      printf(“數(shù)組已滿n”);

      } } getchar();} void bublesort(Seqlist *p){ int temp;for(int i=1;i

      length;i++)

      for(int j=0;j

      length-i;j++)

      if(p->data[j]>p->data[j+1])

      {

      temp=p->data[j];

      p->data[j]=p->data[j+1];

      p->data[j+1]=temp;

      } } void insertsort(Seqlist *p){ int i,j,temp;for(i=1;i

      length;i++){

      temp=p->data[i];

      j=i;

      while(j>0&&temp

      data[j-1])

      {

      p->data[j]=p->data[j-1];

      j--;

      }

      p->data[j]=temp;} } void display(Seqlist *p){ int i;for(i=0;i

      length;i++)

      printf(“%-5d”,p->data[i]);putchar('n');getchar();} int main(void){ Seqlist *p,*q;char flag;p=init();q=(Seqlist *)malloc(sizeof(Seqlist));q->length=0;printf(“1-輸入數(shù)據(jù) 2-直接插入排序 3-冒泡排序 4-顯示 0-退出n”);while(1){

      printf(“請(qǐng)輸入操作:”);

      switch(flag=getchar())

      {

      case '1' : insert(p);break;

      case '2' : *q=*p;insertsort(q);printf(“直接插入排序后的數(shù)據(jù)為:”);display(q);break;

      case '3' : *q=*p;bublesort(q);printf(“冒泡排序后的數(shù)據(jù)為:”);display(q);break;

      case '4' : printf(“原數(shù)據(jù)為:”);display(p);break;

      case '0' : free(p);return 0;

      } } return 0;}

      第三篇:計(jì)算機(jī)軟件技術(shù)基礎(chǔ)實(shí)驗(yàn)報(bào)告

      計(jì)算機(jī)軟件技術(shù)基礎(chǔ)

      實(shí)驗(yàn)報(bào)告

      自動(dòng)化0901班

      郝萬(wàn)福

      學(xué)號(hào):20092395 實(shí)驗(yàn)1:線性表的排序與查找

      目的:

      掌握數(shù)據(jù)結(jié)構(gòu)的基本概念、線性表的基本操作以及查找和排序方法的設(shè)計(jì)。內(nèi)容:

      鍵盤輸入一組無(wú)序數(shù)據(jù),添加到線性表中; 排序線性表并輸出排序結(jié)果;

      鍵盤輸入一個(gè)數(shù),并插入到排好序的線性表中(要求插入后的表仍為有序表),輸出結(jié)果;

      鍵盤輸入一個(gè)數(shù),并從線性表中刪除相應(yīng)的數(shù)據(jù),輸出結(jié)果。要求:

      程序清單;

      運(yùn)行過(guò)程及運(yùn)行結(jié)果。

      實(shí)驗(yàn)代碼:

      /*

      */

      #include “stdafx.h” #include “iostream” #include

      // 程序?qū)崿F(xiàn)有各種方法,這里給出一個(gè)實(shí)例。

      // 定義一個(gè)線性表

      const int nMaxSize = 15;// 最大值 int nLen = 0;

      // 定義操作 void LSort();void LOut();void LInsert(int n);void LDelete(int n);

      int main(){

      // 輸入數(shù)據(jù)并放入線性表中

      printf(“Please input datan”);// std::cout << “Please input datan”;int nIn = 0;

      // 表中元素個(gè)數(shù)

      int nLinearList[nMaxSize];班級(jí):自動(dòng)化 0901 班 姓名:郝萬(wàn)福 學(xué)號(hào):20092395

      編譯環(huán)境: Visual Studio 2011 Windows 7 x86-64 旗艦版

      } for(int i = 0;i <= 9;i++){

      }

      LSort();// 排序線性表 LOut();// 輸出結(jié)果 scanf(“%d”,&nIn);nLen++;

      //

      std::cin >> nIn;

      nLinearList[i] = nIn;printf(“Please input a data to insert n”);scanf(“%d”,&nIn);LInsert(nIn);LOut();printf(“Please input a data to delete n”);scanf(“%d”,&nIn);LDelete(nIn);LOut();char chTmp;printf(“Please input a char to finish this program.”);chTmp = getch();return 0;// 輸入一個(gè)數(shù)字,并從線性表中刪除 // 輸入一個(gè)數(shù)字,并插入到線性表中

      void LSort(){

      }

      void LOut(){

      // 冒泡排序,由大到小

      for(int j=0;j<=10;j++){

      } for(int i=0;i<11-j;i++)

      if(nLinearList[i]

      int temp=nLinearList[i];nLinearList[i]=nLinearList[i+1];nLinearList[i+1]=temp;} printf(“n”);for(int i = 0;i < nLen;i++){

      } } printf(“%d, ”, nLinearList[i]);printf(“n”);void LInsert(int n){ nLen++;nLinearList[nLen] = n;for(int k=0;k<=nLen;k++){for(int l=0;l

      實(shí)驗(yàn)結(jié)果:

      實(shí)驗(yàn)2:棧與隊(duì)列的應(yīng)用

      目的:

      掌握棧與隊(duì)列的基本概念、基本操作及設(shè)計(jì)與應(yīng)用。內(nèi)容:

      鍵盤輸入算數(shù)表達(dá)式,并放入隊(duì)列當(dāng)中; 應(yīng)用棧的概念設(shè)計(jì)表達(dá)式求值算法; 輸出表達(dá)式求值結(jié)果; 要求:

      程序清單;

      運(yùn)行過(guò)程及運(yùn)行結(jié)果。

      要求:

      實(shí)現(xiàn)實(shí)驗(yàn)內(nèi)容的SQL語(yǔ)句,以及輸出結(jié)果

      為檢驗(yàn)實(shí)驗(yàn)內(nèi)容的有效性而執(zhí)行的SQL語(yǔ)句,例如向數(shù)據(jù)表中插入數(shù)據(jù); 檢驗(yàn)運(yùn)行結(jié)果(例如插入、刪除)的SQL語(yǔ)句,以及輸出的結(jié)果。

      實(shí)驗(yàn)代碼:

      /*

      */

      #include “stdafx.h” #include #include #include #include using namespace std;

      const int MAX_LEN = 10;

      // 定義一個(gè)隊(duì)列的結(jié)構(gòu)

      struct QUEUE {

      int nMaxSize;int nCount;int nFront;// 最大值 // 個(gè)數(shù) // 頭

      // 字符串的長(zhǎng)度

      const int MAX_SIZE = 30;// ?;蜿?duì)的最大元素個(gè)數(shù) 班級(jí):自動(dòng)化 0901 班 姓名:郝萬(wàn)福 學(xué)號(hào):20092395

      編譯環(huán)境: Visual Studio 2011 Windows 7 x86-64 旗艦版

      int nRear;// 尾

      char szQueue[MAX_SIZE][MAX_LEN];} QQ;//定義一個(gè)棧的結(jié)構(gòu)

      struct STACK {

      // 隊(duì)列的操作

      void InitQueue(QUEUE *q,int nMaxSize){

      } void InQueue(QUEUE *q, char *pItem){

      } void OutQueue(QUEUE *q, char *pItem){

      if(q->nCount == 0){

      } q->nCount--;int i;printf(“隊(duì)列已空n”);getch();return 0;if(q->nMaxSize == q->nCount){

      } q->nCount++;int i;for(i=0;i<10;i++){ } q->nFront ++;return;q->szQueue[q->nFront][i]= pItem[i];printf(“隊(duì)列已滿n”);getch();return 0;q->nMaxSize=nMaxSize;q->nCount=0;q->nFront=0;q->nRear=0;int nMaxSize;int nTop;// 最大值 // 棧頂

      char szStack[MAX_SIZE][MAX_LEN];} ST;

      }

      for(i=0;i<10;i++){ } q->nRear ++;return;pItem[i] = q->szQueue[q->nRear][i];//棧的操作

      void InitStack(STACK *s,int nMaxSize){

      } void PushStack(STACK *s, char *pItem){

      } void PopStack(STACK *s, char *pItem){ if(s->nTop == 0){

      } printf(“堆棧已空n”);getch();return 0;if(s->nTop == s->nMaxSize-1){

      } for(int i=0;i<10;i++){ } s->nTop++;s->szStack[s->nTop][i]= pItem[i];printf(“堆棧已滿n”);getch();return 0;s->nMaxSize=nMaxSize;s->nTop=0;// 棧頂

      // 最大值

      s->nTop--;for(int i=0;i<10;i++){ } void GetTopStack(STACK *s, char *pItem){ pItem[i] = s->szStack[s->nTop][i];}

      } for(int i=0;i<10;i++)pItem[i] = s->szStack[s->nTop-1][i];{ } int Priority(char *op);式的值

      int main(){ int i=0;

      char c,temp[10];

      // 聲明一個(gè)隊(duì)列 QUEUE qq;

      // 聲明OS棧和NS棧 STACK ns,os;

      // 獲得操作符的優(yōu)先級(jí)

      // 計(jì)算表達(dá)void Compute(char *num1, char *num2, char *op, char *chResult);

      InitQueue(&qq,MAX_SIZE);InitStack(&ns,MAX_SIZE);char x[MAX_LEN];char op[MAX_LEN];

      // 定義掃描的表達(dá)式

      // 棧頂運(yùn)算符 // 運(yùn)算結(jié)果 InitStack(&os,MAX_SIZE);char num1[MAX_LEN], num2[MAX_LEN];// 兩個(gè)操作數(shù) char chResult[MAX_LEN];printf(“Input expression please:n”);while((c=getchar())!='n'){

      InQueue(&qq,temp);temp[0]=c;InQueue(&qq,temp);i=0;

      if(isdigit(c)){ } else {

      for(;i<10;i++){ } temp[i]='