當前位置:首頁 » 操作系統 » 演算法設計課程設計

演算法設計課程設計

發布時間: 2022-05-05 01:24:34

演算法課程設計報告

題目中要求的功能進行敘述分析,並且設計解決此問題的數據存儲結構,(有些題目已經指定了數據存儲的,按照指定的設計),設計或敘述解決此問題的演算法,描述演算法建議使用流程圖,進行演算法分析指明關鍵語句的時間復雜度。
給出實現功能的一組或多組測試數據,程序調試後,將按照此測試數據進行測試的結果列出來 。
對有些題目提出演算法改進方案,比較不同演算法的優缺點。
如果程序不能正常運行,寫出實現此演算法中遇到的問題,和改進方法;
2 對每個題目要有相應的源程序(可以是一組源程序,即詳細設計部分):
源程序要按照寫程序的規則來編寫。要結構清晰,重點函數的重點變數,重點功能部分要加上清晰的程序注釋。
程序能夠運行,要有基本的容錯功能。盡量避免出現操作錯誤時出現死循環;
3 最後提供的主程序可以象一個應用系統一樣有主窗口,通過主菜單和分級菜單調用課程設計中要求完成的各個功能模塊,調用後可以返回到主菜單,繼續選擇其他功能進行其他功能的選擇。最好有窗口展示部分。
4 課程設計報告:(保存在word 文檔中,文件名要求 按照"姓名-學號-課程設計報告"起名,如文件名為"張三-001-課程設計報告".doc )按照課程設計的具體要求建立的功能模塊,每個模塊要求按照如下幾個內容認真完成;
其中包括:
a)需求分析:
在該部分中敘述,每個模塊的功能要求
b)概要設計
在此說明每個部分的演算法設計說明(可以是描述演算法的流程圖),每個程序中使用的存儲結構設計說明(如果指定存儲結構請寫出該存儲結構的定義。
c)詳細設計
各個演算法實現的源程序,對每個題目要有相應的源程序(可以是一組源程序,每個功能模塊採用不同的函數實現)
源程序要按照寫程序的規則來編寫。要結構清晰,重點函數的重點變數,重點功能部分要加上清晰的程序注釋。
d)調試分析
測試數據,測試輸出的結果,時間復雜度分析,和每個模塊設計和調試時存在問題的思考(問題是哪些?問題如何解決?),演算法的改進設想。
5. 課設總結: (保存在word 文檔中)總結可以包括 : 課程設計 過程的收獲、遇到問題、遇到問題解決問題過程的思考、程序調試能力的思考、對數據結構這門課程的思考、在課程設計過程中對C課程的認識等內容;
6.實驗報告的首頁請參考如下格式:

課程設計實驗
起止日期:20 -20 學年 學期
系別 班級 學號 姓名
實驗題目 □設計性 □綜合性
自我評價
教師評語 能夠實現實驗要求的功能 □全部 □部分演算法有新意 □有 □一般程序運行通過 □全部 □部分 演算法注釋說明 □完善 □僅有功能說明介面參數說明 □有 □無按期上交列印文檔資料及源程序 □所有 □部分綜合設計說明報告結構 □合理 □不合理用戶使用說明 □完整 □不全現場演示操作有準備 □有 □無問題解答流暢 □流暢 □不流暢獨立完成實驗 □能 □不能體現團隊合作精神。 □能夠 □不能
成績

這是張表格,過來時沒調整好,不過應該看得明白。我們是這樣寫的,你可以參考一下。

⑵ 數據結構與演算法課程設計求助

看上去有點象游戲引擎。
我最近也在研究這個。

不過,這是編譯原理的范疇。

具體實現起來很復雜的,不過,可以給你一些大致的思路:

1、文本編輯器或者源代碼讀取程序(可以是用戶輸入或者從文件讀入)
2、詞法分析。(其實詞法分析就是將各個元素比如變數、關鍵字、運算符等分離出來)
3、語法分析,語義分析。(其作用是生成語法樹)
4、解釋器,運行時環境。(維護程序運行時的環境,比如局部變數的建立、撤銷;函數調用時環境的保存;堆、棧維護等。另外,還要提供固有命令(函數)的實現,就是說,用戶調用了固有的命令時,將會發生什麼。)

總的來說,很復雜的。這是一個很大的項目。別說200分,就是2000元,也很難找到。

推薦你看看編譯原理(不過國內的編譯原理的書籍,都只講皮毛,要看就看英文的)另外,有一本《高級游戲腳本程序設計》不錯。

再就是,你可以使用現成的語法分析生成器,比如:Lex+Yacc,不過需要修改生成的代碼,才能在VC中使用。

⑶ 排序演算法課程設計

// 各種排序演算法匯總.cpp : 定義控制台應用程序的入口點。
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

#include <stack>
#include <time.h>
#include <stdlib.h>

template < typename T >
class SqList
{
private:
int length;
T * r;
public://介面
SqList(int n = 0);//構造長度為n的數組
~SqList()
{
length = 0;
delete r;
r = NULL;
}
void InsertSort();//順序插入排序
void DisPlay();//輸出元素
void BInsertSort();//折半插入排序
void ShellSort(int dlta[],int t);//希爾排序
void QuickSort();//快速排序
void SelectSort();//簡單選擇排序
void BubbleSort();//改進冒泡排序
void Bubble_Sort2();//相鄰兩趟是反方向起泡的冒泡排序演算法
void Bubble_Sort3();//對相鄰兩趟反方向演算法進行化簡,循環體中只包含一次冒泡
void HeapSort();//堆排序
void Build_Heap_Sort();//堆排序由小到大序號建立大根堆
void MergeSort();//歸並排序
void OE_Sort();//奇偶交換排序的演算法

void Q_Sort_NotRecurre();//非遞歸快速排序
void HeapSort_3();//三叉堆排序

public://調用
void ShellInsert(int dk);//一趟希爾排序
void QSort(int low,int high);//快速排序
int Partition(int low,int high);//一趟快速排序
int SelectMinKey(int i);//從i到length中選擇最小值下標
void HeapAdjust(int s,int m);//調整s的位置,其中s+1~m有序
void HeapAdjust_3(int s,int m);//三叉堆****調整s的位置,其中s+1~m有序
void Merge(T SR[],T TR[],int i,int m,int n);//歸並
void MSort(T SR[],T TR1[],int s,int t);//歸並
void Easy_Sort(int low,int high);//3個數直接排序
void Build_Heap(int len);//從低下標到高下標逐個插入建堆的演算法***建立大根堆**但為排序

};
template < typename T >
SqList<T>::SqList(int n = 0)
{
//srand( time(0) );
length = n;
r=new T[length+1];
T t;
cout<<"隨機生成"<<n<<"個值:"<<endl;
for (int i=1;i<=length;i++)
{
//cin>>t;
r[i] = rand()%1000;
//r[i] = t;
}
for (int i=1; i<=length;i++)
cout<<r[i]<<",";
cout<<endl;
}
template < typename T >
void SqList<T>::InsertSort()
{
int i,j;
for (i=2;i<=length;i++)
{
if (r[i]<r[i-1])
{
r[0]=r[i];
r[i]=r[i-1];
for (j=i-2;r[0]<r[i-2];j--)
r[j+1]=r[j];
r[j+1]=r[0];
}
}
}
template < typename T >
void SqList<T>::DisPlay()
{
int i;
cout<<length<<" 元素為:"<<endl;
for (i = 1;i < length+1;i++ )
{
cout<<r[i]<<" ,";
}
cout<<endl;
}
template < typename T >
void SqList<T>::BInsertSort()
{
int i, j, m;
int low,high;
for (i = 2;i<= length;i++)
{
r[0]=r[i];
low=1;
high=i-1;
while (low<=high)
{
m = (low+high)/2;
if ( r[0] < r[m] )
high=m-1;
else
low=m+1;
}
for ( j=i-1;j >=high+1; j--)
{
r[j+1] = r[j];
}
r[high+1] = r[0];
}
}

template < typename T >
void SqList<T>::ShellInsert(int dk)
{
int i,j;
for (i=dk+1;i<=length;i++)
if (r[i] < r[i-dk])
{
r[0] = r[i];
for ( j=i-dk; j>0 && r[0] < r[j]; j-=dk)
{
r[j+dk]=r[j];
}
r[j+dk] = r[0];
}
}
template < typename T >
void SqList<T>::ShellSort(int dlta[],int t)
{
int k=0;
for (;k<t;k++)
{
ShellInsert(dlta[k]);
}
}
template < typename T >
int SqList<T>::Partition(int low,int high)
{
int pivotkey;
r[0] = r[low];//記錄樞軸值
pivotkey = r[low];
while (low < high)
{
while (low < high&& r[high] >= pivotkey)
high--;
r[low] = r[high];
while (low < high&& r[low] <= pivotkey)
low++;
r[high] = r[low];
}
r[low] = r[0];//樞軸記錄到位
return low;//返回樞軸位置
}
template < typename T >
void SqList<T>::QSort(int low,int high)
{
int pivotloc;
if (low < high)
{
pivotloc = Partition(low,high);
QSort(low,pivotloc-1);
QSort(pivotloc+1,high);
}
}
template < typename T >
void SqList<T>::QuickSort()
{
QSort(1,length);
}
template < typename T >
int SqList<T>::SelectMinKey(int i)
{
int j,min=i;
for (j=i;j <= length;j++)
{
if (r[min] > r[j])
{
min = j;
}
}
return min;
}
template < typename T >
void SqList<T>::SelectSort()
{
int i,j;
T t;
for (i=1;i < length;i++)//循環length-1次不是length次
{
j=SelectMinKey(i);
if (i != j)
{
t= r[j];
r[j]=r[i];
r[i]=t;
}
}
}
template < typename T >
void SqList<T>::BubbleSort()
{
int i,j;
int flag=1;//標識位,如果出現0,則沒有交換,立即停止
T t;
for (i=1;i < length && flag;i++)
{
flag = 0;
for (j=length-1;j>=i;j--)
if (r[j]>r[j+1])
{
t=r[j];
r[j]=r[j+1];
r[j+1]=t;
flag=1;
}
}
}
template < typename T >
void SqList<T>::Bubble_Sort2()
{
bool change = true;
int low = 1, high = length;
int i;
T t;
while ( (low < high) && change )
{
change = false;
for ( i = low; i < high; i++ )
{
if ( r[i] > r[i+1] )
{
t = r[i];
r[i] = r[i+1];
r[i+1] = t;
change = true;
}
}
high-=1;
for ( i = high; i > low; i-- )
{
if ( r[i] < r[i-1] )
{
t = r[i];
r[i] = r[i-1];
r[i-1] = t;
change = true;
}
}
low+=1;
}
}

template < typename T >
void SqList<T>::Bubble_Sort3()
{
int i,d=1;
bool change = true;
int b[3] = {1,0,length};//b[0]為冒泡的下界,b[ 2 ]為上界,b[1]無用
T t;
while (change)//如果一趟無交換,則停止
{
change = false;
for ( i=b[1-d]; i!=b[1+d]; i=i+d )//統一的冒泡演算法
{
if ( (r[i]-r[i+d])*d > 0 )///注意這個交換條件
{
t = r[i];
r[i] = r[i+d];
r[i+d] = t;
change = true;
}
}
d = d*(-1);//換個方向
}
}
template < typename T >
void SqList<T>::HeapAdjust(int s,int m)
{
/* 已知H.r[s..m]中記錄的關鍵字除H.r[s].key之外均滿足堆的定義,本函數 */
/* 調整H.r[s]的關鍵字,使H.r[s..m]成為一個大頂堆(對其中記錄的關鍵字而言) */
int j;
T rc = r[s];
for (j=2*s;j <= m;j*=2)
{
/* 沿key較大的孩子結點向下篩選 */
if (j < m && r[j] < r[j+1])
j++;/* j為key較大的記錄的下標 */
if (rc >= r[j])
break;/* rc應插入在位置s上 ,無需移動*/
r[s]=r[j];
s=j;
}
r[s]=rc;/* 插入 */
}
template < typename T >
void SqList<T>::HeapSort()
{
/* 對順序表H進行堆排序。演算法10.11 */
T t;
int i;
for (i=length/2;i>0;i--)/* 把H.r[1..H.length]建成大頂堆 */
HeapAdjust(i,length);
for (i=length;i>1;i--)
{
/* 將堆頂記錄和當前未經排序子序列H.r[1..i]中最後一個記錄相互交換 */
t=r[1];
r[1]=r[i];
r[i]=t;
HeapAdjust(1,i-1);/* 將H.r[1..i-1]重新調整為大頂堆 */
}
}
template < typename T >
void SqList<T>::Build_Heap_Sort()
{
int i;
Build_Heap(length);
for ( i = length; i > 1; i-- )
{
T t;
t = r[i];
r[i] = r[1];
r[1] = t;
Build_Heap(i-1);
}

}
template < typename T >
void SqList<T>::Build_Heap(int len)
{
T t;
for (int i=2; i <= len; i++ )
{
int j = i;
while ( j != 1 )
{
int k = j/2;
if ( r[j] > r[k] )
{
t = r[j];
r[j] = r[k];
r[k] = t;
}
j = k;
}
}

}
template < typename T >
void SqList<T>::Merge(T SR[],T TR[],int i,int m,int n)
{
/* 將有序的SR[i..m]和SR[m+1..n]歸並為有序的TR[i..n] 演算法10.12 */
int j,k,x;
for (j=m+1,k=i;j<=n&&i<=m;k++)/* 將SR中記錄由小到大地並入TR */
{
if (SR[i]<SR[j])
TR[k]=SR[i++];
else
TR[k]=SR[j++];
}
if (i<=m)
for (x=0;x<=m-i;x++)
TR[k+x]=SR[i+x];/* 將剩餘的SR[i..m]復制到TR */
if (j<=n)
for (x=0;x<=n-j;x++)
TR[k+x]=SR[j+x];/* 將剩餘的SR[j..n]復制到TR */
}
template < typename T >
void SqList<T>::MSort(T SR[],T TR1[],int s,int t)
{
/* 將SR[s..t]歸並排序為TR1[s..t]。演算法10.13 */
int m;
T *TR2=new T[length+1];
if (s==t)
TR1[s]=SR[s];
else
{
m=(s+t)/2;/* 將SR[s..t]平分為SR[s..m]和SR[m+1..t] */
MSort(SR,TR2,s,m);/* 遞歸地將SR[s..m]歸並為有序的TR2[s..m] */
MSort(SR,TR2,m+1,t);/* 遞歸地將SR[m+1..t]歸並為有序的TR2[m+1..t] */
Merge(TR2,TR1,s,m,t);/* 將TR2[s..m]和TR2[m+1..t]歸並到TR1[s..t] */
}
}
template < typename T >
void SqList<T>::MergeSort()
{
MSort(r,r,1,length);
}
template < typename T >
void SqList<T>::OE_Sort()
{
int i;
T t;
bool change = true;
while ( change )
{
change = false;
for ( i=1;i<length;i+=2 )
{
if (r[i] > r[i+1])
{
t = r[i];
r[i] = r[i+1];
r[i+1] = t;
change = true;
}
}
for ( i=2;i<length;i+=2 )
{
if ( r[i] > r[i+1] )
{
t = r[i];
r[i] = r[i+1];
r[i+1] = t;
change = true;
}
}

}

}
typedef struct
{
int low;
int high;
}boundary;
template <typename T >
void SqList<T>::Q_Sort_NotRecurre()
{
int low=1,high=length;
int piv;
boundary bo1,bo2;
stack<boundary> st;
while (low < high)
{
piv = Partition(low,high);
if ( (piv-low < high-piv) && (high-piv > 2) )
{
bo1.low = piv+1;
bo1.high = high;
st.push(bo1);
high = piv-1;
}
else if ( (piv-low > high-piv) && (piv-low >2) )
{
bo1.low = low;
bo1.high = piv-1;
st.push(bo1);
low = piv+1;
}
else
{
Easy_Sort(low,high);
high = low;
}
}
while ( !st.empty() )
{
bo2 = st.top();
st.pop();
low = bo2.low;
high = bo2.high;
piv = Partition(low, high);
if ( (piv-low < high-piv) && (high-piv > 2) )
{
bo1.low = piv+1;
bo1.high = high;
st.push(bo1);
high = piv-1;
}
else if ( (piv-low > high-piv) && (piv-low >2) )
{
bo1.low = low;
bo1.high = piv-1;
st.push(bo1);
low = piv+1;
}
else
{
Easy_Sort(low,high);
}
}

}
template < typename T >
void SqList<T>::Easy_Sort(int low,int high)
{
T t;
if ( (high-low) == 1 )
{
if ( r[low] > r[high] )
{
t = r[low];
r[low] = r[high];
r[high] = t;
}
}
else
{
if ( r[low] > r[low+1] )
{
t = r[low];
r[low] = r[low+1];
r[low+1] = t;
}
if ( r[low+1] > r[high] )
{
t = r[low+1];
r[low+1] = r[high];
r[high] = t;
}
if ( r[low] > r[low+1] )
{
t = r[low];
r[low] = r[low+1];
r[low+1] = t;
}
}

}

template < typename T >
void SqList<T>::HeapAdjust_3(int s,int m)
{
T rc = r[s];
for (int j = 3*s-1; j <= m;j=j*3-1)
{
if (j+1<m)//有3個孩子結點
{
if ( rc>=r[j] && rc>=r[j+1] && rc>=r[j+2] )
break;
else
{
if ( r[j] > r[j+1] )
{
if ( r[j] > r[j+2] )
{
r[s]=r[j];
s=j;
}
else//r[j]<=r[j+2]
{
r[s]=r[j+2];
s=j+2;
}
}
else//r[j]<=r[j+1]
{
if ( r[j+1] > r[j+2] )
{
r[s]=r[j+1];
s=j+1;
}
else//r[j+1]<=r[j+2]
{
r[s]=r[j+2];
s=j+2;
}
}
}
}
if ( j+1==m )//有2個孩子結點
{
if ( rc>=r[j] && rc>=r[j+1] )
break;
else
{
if ( r[j] > r[j+1] )
{
r[s]=r[j];
s=j;
}
else//r[j]<=r[j+1]
{
r[s]=r[j+1];
s=j+1;
}
}
}
if (j==m)//有1個孩子結點
{
if ( rc>=r[j] )
break;
else
{
r[s]=r[j];
s=j;
}
}
}
r[s]=rc;
}

template <typename T >
void SqList<T>::HeapSort_3()
{
int i;
T t;
for (i=length/3; i>0; i--)
HeapAdjust_3(i,length);
for ( i=length; i > 1; i-- )
{
t = r[i];
r[i] = r[1];
r[1] = t;
HeapAdjust_3(1,i-1);
}
}

int _tmain(int argc, _TCHAR* argv[])
{
SqList<int> Sq(15);
//Sq.InsertSort();
//Sq.BInsertSort();
/* 希爾排序*/
// int a[5]={5,4,3,2,1};
// Sq.ShellSort(a,5);

/* Sq.QuickSort();*/

// Sq.SelectSort();

/* Sq.BubbleSort();*/

/* Sq.HeapSort();*/

/* Sq.MergeSort();*/

/* Sq.Q_Sort_NotRecurre();*/

/* Sq.Bubble_Sort2();*/
/* Sq.OE_Sort();*/
/* Sq.Bubble_Sort3();*/

/* Sq.Build_Heap_Sort();*/

Sq.HeapSort_3();

Sq.DisPlay();
system("pause");
return 1;
}

⑷ 實時調度演算法的課程設計 要用c語言

#include<stdio.h>
int main()
{
int A,B; //標記進程A,進程B的到達時間
int cycA,cycB,serveA,serveB; //進程的周期時間和服務時間
float m;
int i,j,a=0,b=0,ka=0,kb=0; //ka,kb為開關,i,j,a,b為進程下標
int numa=0,numb=0; //服務累計時間
printf("輸入進程A的周期時間,服務時間:");
scanf("%d%d",&cycA,&serveA);
printf("輸入進程B的周期時間,服務時間:");
scanf("%d%d",&cycB,&serveB);
m=(float)serveA/cycA+(float)serveB/cycB;
for(int T=0;T<=100;T++)
{
if(m-1>1e-6)
{
printf("超出CPU的處理能力!\n");
return 0;
}
if(numa==serveA) //進程A完成
{
numa=serveA+1;
printf("當T=%d時",T);
printf("進程A%d結束\n",a);
if(numb<serveB)
{
printf(" 調用進程b%d\n",b);
kb=1;
}
ka=0;
}
if(numb==serveB)
{
numb=serveB+1;
printf("當T=%d時",T);
printf("進程B%d結束\n",b);
if(numa<serveA)
{
printf(" 調用進程A%d\n",a);
ka=1;
}
kb=0;
}
if(T%cycA==0 && T%cycB==0)
{
A=B=T;
j=++a;
i=++b;
printf("當T=%d時,進程A%d和進程B%d同時產生,此時,",T,j,i);
if(cycA<=cycB)
{
printf("調用進程A%d,阻塞進程B%d\n",j,i);
ka=1;
kb=0;
}
else
{
printf("調用進程B%d,阻塞進程A%d\n",i,j);
ka=0;
kb=1;
}
numa=numb=0;
}
if(T%cycA==0&&T%cycB!=0)
{
A=T;
printf("當T=%d時",T);
printf("進程A%d產生 ",++a); //不可能與進程A競爭處理器
numa=0;
if(numb<serveB) //進程B沒有完成
if(B+cycB>A+cycA) //若進程B最早截止時間大於進程A的
{
printf("進程A%d執行。\n",a);
ka=1;
kb=0;
}
else //若進程B最早截止時間小於等於進程A的
printf("進程B%d繼續執行。\n",b);
else //進程B完成
{
printf("進程A%d執行。\n",a);
ka=1;
}
}
if(T%cycA!=0&&T%cycB==0)
{
B=T;
printf("當T=%d時",T);
printf("進程B%d產生,",++b); //不可能與進程B競爭處理器
numb=0;
if(numa<serveA) //進程A沒有完成
if(B+cycB>=A+cycA) //進程A的最早截止時間不小於B
printf("進程A%d繼續執行。\n",a);
else
{
printf("進程B%d執行。\n",b);
kb=1;
ka=0;
}
else //進程A完成
{
printf("進程B%d執行。\n",b);
kb=1;
}
}
if(ka)
numa++;
if(kb)
numb++;
}
}

⑸ 數據結構與演算法課程設計——集合運算

#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
struct set{
int coef;
struct set *next;
};

void createlist_p(struct set *&p,int n)
{
int i;
struct set *L;
p=(struct set *)malloc(sizeof(set));
p->next=NULL;
for(i=n;i>0;i--)
{
L=(struct set *)malloc(sizeof(set));
printf("請輸入該集合中第%d個整數元素:",n-i+1);
scanf("%d",&L->coef);
L->next=p->next;
p->next=L;
}
}//生成新鏈表用於存放兩集合中的元素
void printlist_p(struct set *&p)
{
struct set *L;
int i;
L=p->next;
if(!L) printf("該表為空!\n");
while(L!=NULL)
{
printf("%d ",L->coef);
L=L->next;
i++;
}
printf("\n");
}//列印輸入的兩集合中的元素
void Addset(struct set *&p,struct set *&q,struct set *&r)
{
struct set *k,*m,*n;
r=(struct set *)malloc(sizeof(set));
r->next=NULL;
k=p->next;
for(;k;)
{
m=(struct set *)malloc(sizeof(set));
m->next=r->next;
r->next=m;
m->coef=k->coef;
k=k->next;
}//把第一個集合中的元素放在新集合中
k=q->next;
m=(struct set *)malloc(sizeof(set));
m->next=r->next;
r->next=m;
m->coef=k->coef;
k=k->next;
for(;k;)
{
for(n=r->next;(k->coef!=n->coef)&&n->next;){
n=n->next;
}//與新集合中的元素比較
if((k->coef!=n->coef)&&!(n->next)){
m=(struct set *)malloc(sizeof(set));
m->next=r->next;
r->next=m;
m->coef=k->coef;
}
k=k->next;
}//對第二個集合中的元素進行分析

}//求A∪B
void Subset(struct set *&p,struct set *&q,struct set *&r){
struct set *k,*m,*n;
r=(struct set *)malloc(sizeof(set));
r->next=NULL;
n=q->next;
for(;n;){
m=p->next;
for(;(m->coef!=n->coef)&&m->next;){
m=m->next;
}
if(m->coef==n->coef) {
k=(struct set *)malloc(sizeof(set));
k->next=r->next;
r->next=k;
k->coef=m->coef;
}
n=n->next;
}

}//求A∩B
void Intset(struct set *&p,struct set *&q,struct set *&r){
struct set *k,*m,*n;
r=(struct set *)malloc(sizeof(set));
r->next=NULL;
m=p->next;
for(;m;){
n=q->next;
for(;(m->coef!=n->coef)&&n->next;){
n=n->next;
}
if(!n->next&&(m->coef!=n->coef)) {
k=(struct set *)malloc(sizeof(set));
k->next=r->next;
r->next=k;
k->coef=m->coef;
}
m=m->next;
}
}//求A-B
void bangzhu(){
printf("\n\t\t\t***********************************");
printf("\n\t\t\t* 求集合的交並差 *");
printf("\n\t\t\t*********************************\n");
}
void main()
{
struct set *p,*q,*r;
int m,n,node;
bangzhu();

for(;;)
{
do{
printf("請輸入您要選擇操作的代碼:\n");
printf("1:求兩集合的並A∪B\n");
printf("2:求兩集合的交A∩B\n");
printf("3:求兩集合的差A-B\n");
printf("0:退出該程序\n");
scanf("%d",&node);
} while(node<0||node>3);

if(node==0) exit(1);
printf("\t\t\t/*請輸入集合A中元素的個數:*/\n");
scanf("%d",&m);
createlist_p(p,m);
printf("\t\t\t/*請輸入集合B中元素的個數:*/\n");
scanf("%d",&n);
createlist_p(q,n);
printf("集合A中元素為:");
printlist_p(p);
printf("集合B中元素為:");
printlist_p(q);
while(node<0||node>3);
switch(node)
{
case 1: Addset( p,q,r);printf("A∪B:\n");printlist_p(r);break;
case 2: Subset( p,q,r);printf("A∩B:\n");printlist_p(r);break;
case 3: Intset(p,q,r); printf("A-B:\n");printlist_p(r);break;
}
printf("\n");
}
}
可以了
樓上方法是正確的,學習!把分給樓上

⑹ 計算方法與程序設計學什麼的

計算機科學與技術專業培養和造就適應會主義現代化建設需要,德智體全面發展、基礎扎實、知識面寬、能力強、素質高具有創新精神,系統掌握計算機硬體、軟體的基本理論與應用基本技能,具有較強的實踐能力,能在企事業單位、政府機關、行政管理部門從事計算機技術研究和應用,硬體、軟體和網路技術的開發,計算機管理和維護的應用型專門技術人才。
本專業學生主要學習計算機科學與技術方面的基本理論和基本知識,接受從事研究與應用計算機的基本訓練,具有研究和開發計算機系統的基本能力。
本科畢業生應獲得以下幾方面的知識和能力:
1.掌握計算機科學與技術的基本理論、基本知識;
2.掌握計算機系統的分析和設計的基本方法;
3.具有研究開發計算機軟、硬體的基本能力;
4.了解與計算機有關的法規;
5.了解計算機科學與技術的發展動態;
6.掌握文獻檢索、資料查詢的基本方法,具有獲取信息的能力。
主要課程:電路原理、模擬電子技術、數字邏輯、數值分析、計算機原理、微型計算機技術、計算機系統結構、計算機網路、高級語言、匯編語言、數據結構、操作系統、資料庫原理、編譯原理、圖形學、人工智慧、計算方法、離散數學、概率統計、線性代數以及演算法設計與分析、人機交互、面向對象方法、計算機英語等。
主要實踐性教學環節:包括電子工藝實習、硬體部件設計及調試、計算機基礎訓練、課程設計、計算機工程實踐、生產實習、畢業設計(論文)。

熱點內容
第三方伺服器做海康存儲怎麼配置 發布:2024-10-07 00:23:38 瀏覽:116
文件夾兩孔 發布:2024-10-06 23:48:53 瀏覽:352
ftp工具分析 發布:2024-10-06 23:48:51 瀏覽:158
伺服器被游戲封機器碼怎麼辦 發布:2024-10-06 23:46:10 瀏覽:161
股票java 發布:2024-10-06 23:38:46 瀏覽:291
安卓演算法 發布:2024-10-06 23:14:20 瀏覽:184
域名訪問404 發布:2024-10-06 23:08:52 瀏覽:708
訪問筆錄模版 發布:2024-10-06 22:36:54 瀏覽:142
多用途編程 發布:2024-10-06 22:35:58 瀏覽:618
msde2000資料庫下載 發布:2024-10-06 22:33:35 瀏覽:45