




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、#include<iostream>using namespace std;void main()int p,q;cout<<"請(qǐng)輸入p和q的值:"<<endl;cin>>p>>q;cout<<"輸出p的否定是:"<<!p<<endl;cout<<"輸出p的否定是:"<<!q<<endl;cout<<"輸出p與q的合取是:"<<(p&&q)<
2、;<endl;cout<<"輸出p與的析取是:"<<(p|q)<<endl;cout<<"輸出p與q的條件式是:"<<(!p)|q)<<endl;if(p=0&&q=0)|(p!=0&&q!=0)cout<<"輸出p與q的雙條件是:1"<<endl;elsecout<<"輸出p與q的雙條件是:0"<<endl;11級(jí)計(jì)算機(jī)科學(xué)與技術(shù)特色班李徐紅#define
3、MAX_SIZE 100#include<iostream>const int SIZE=6;using namespace std;template <class ElemType>class DataListprivate:ElemType dataMAX_SIZE;int size;void Swap(const int mark1, const int mark2);public:DataList(int sz=6):size(sz) ;DataList(void) ;void SelectSort(void);void Input(void);void Sho
4、w(void);template <class ElemType>void DataList<ElemType>:Swap(const int mark1,const int mark2)ElemType temp;temp=datamark1;datamark1=datamark2;datamark2=temp;template <class ElemType>void DataList<ElemType>:SelectSort(void)for(int i=0;i<size-1;i+)int currLargePos=i;for(int
5、 j=i+1; j<size; j+)if(dataj<datacurrLargePos)currLargePos=j;if(currLargePos!=i)Swap(currLargePos,i);template <class ElemType>void DataList<ElemType>:Input(void)cout<<"輸入元素個(gè)數(shù):"cin>>size;for(int i=0; i<size; i+)cout<<"輸入第"<<i+1<<&q
6、uot;個(gè)數(shù)據(jù)元素:"cin>>datai;template <class ElemType>void DataList<ElemType>:Show(void)cout<<"元素:"for(int i=0; i<size; i+)cout<<datai<<" "cout<<endl;cout<<"元素個(gè)數(shù):"<<size<<endl;int main(void)DataList<int>
7、 List(SIZE);List.Input();cout<<"排序前:"<<endl;List.Show();List.SelectSort();cout<<"排序后:"<<endl;List.Show();system("PAUSE");return 0;#include<iostream>/using namespace std;template<class ElemType>bool SqList<Elemtype>:Full()constre
8、turn count=maxSize;template<class ElemType>void SqList<ElemType>:Init(int size)maxSize=size;if(elems!=NULL)delete elems;elems=new ElemTypemaxSize;count=0;template<class ElemType>SqList<ElemType>:SqList(int size)elems=NULL;Init(size);template<class ElemType>Sqlist<Ele
9、mType>:SqList()deleteelems;template<class ElemType>int SqList<ElemType>:Length()constreturn count;template<class ElemType>bool SqList<ElemType>:empty()constreturn count=o;template<class ElemType>void SqList<ElemType>:Clear()count=0;template<class ElemType>
10、;void SqList<ElemType>:Traverse(void(*visit)(ElemType &)for(int curPosition=1; curPosition<=Length(); curPosition+)(*visit)(elems curPosition-1);template<class ElemType>StatusCode SqList<ElemType>:GetElem(int position,ElemType &e)constif(position<1|position>Length(
11、)return NOT PRESENT;elsee=elemsposition-1;return ENTRY FOUND;template<class ElemType>StatusCode SqList<ElemType>:SetElem(int position,const ElemType &e)if(position<1|position>Length()return RANGE ERROR;elseelemsposition-1=e;return SUCCESS;#define MAX_SIZE 100#include<iostrea
12、m>const int SIZE=6;using namespace std;template <class ElemType>class DataListprivate:ElemType dataMAX_SIZE;int size;void Swap(const int mark1, const int mark2);public:DataList(int sz=6):size(sz) ;DataList(void) ;void SelectSort(void);void Input(void);void Show(void);template <class Elem
13、Type>void DataList<ElemType>:Swap(const int mark1,const int mark2)ElemType temp;temp=datamark1;datamark1=datamark2;datamark2=temp;template <class ElemType>void DataList<ElemType>:SelectSort(void)for(int i=0;i<size-1;i+)int currLargePos=i;for(int j=i+1; j<size; j+)if(dataj&
14、lt;datacurrLargePos)currLargePos=j;if(currLargePos!=i)Swap(currLargePos,i);template <class ElemType>void DataList<ElemType>:Input(void)cout<<"輸入班級(jí)總?cè)藬?shù):"cin>>size;for(int i=0; i<size; i+)cout<<"輸入第"<<i+1<<"個(gè)同學(xué)總成績(jī):"cin>>da
15、tai;template <class ElemType>void DataList<ElemType>:Show(void)cout<<"成績(jī)"for(int i=0; i<size; i+)cout<<datai<<" "cout<<endl;cout<<"學(xué)號(hào)"<<size<<endl;int main(void)DataList<int> List(SIZE);List.Input();cout<
16、<"排序前:"<<endl;List.Show();List.SelectSort();cout<<"排序后:"<<endl;List.Show();system("PAUSE");return 0;#include<iostream>using namespace std;class SqListprotected:int count;int maxSize;ElemType *elems;bool Full() const;void Init(int size);public:
17、SqList(int size=DEFAULT SIZE);virtualSqList();int Length()const;bool Empty()const;void Clear();void Traverse(void(*visit)(const ElemType &)const;StatusCode GetElem(int position,ElemType &e)const;StatusCode SetElem(int position,const ElemType &e);StatusCode Delete(int position,ElemType &a
18、mp;e);StatusCode Insert(int position,const ElemType &e);SqList(const SqList<ElemType>©);SqList<ElemType>&operator=(const SqList<ElemType>©);template<class ElemType>bool SqList<Elemtype>:Full()constreturn count=maxSize;template<class ElemType&g
19、t;void SqList<ElemType>:Init(int size)maxSize=size;if(elems!=NULL)delete elems;elems=new ElemTypemaxSize;count=0;template<class ElemType>SqList<ElemType>:SqList(int size)elems=NULL;Init(size);template<class ElemType>Sqlist<ElemType>:SqList()deleteelems;template<class
20、 ElemType>int SqList<ElemType>:Length()constreturn count;template<class ElemType>bool SqList<ElemType>:empty()constreturn count=o;template<class ElemType>void SqList<ElemType>:Clear()count=0;template<class ElemType>void SqList<ElemType>:Traverse(void(*vis
21、it)(ElemType &)For#include<iostream.h>using namespace std;template<class ElemType>class SqListprotected:int count;int maxsize;ElemType *elems;bool Full()const;void Init(int size);public:SqList(int size=DEFAULT SIZE);virtualSqList();int Length()const;bool Empty const;void Clear();void
22、 Traverse(void(*visit)(const ElemType &)const;StatusCode GetElem(int position,ElemType &e)const;StatusCode SetElem(int position,ElemType &e)const;StatusCode Delete(int position,ElemType &e)const;StatusCodeInsert(int position,const ElemType &e);SqList(const SqList<ElemType>&
23、amp;copy);bool SqList<ElemType>:Full()constreturn count=maxSize;template<class ElemType>void SqList<ElemType>:Init(int size)maxSize=size;if(elems!=NULL) delete elems;elems=new ElemTypemaxSize;count=0;template<class ElemType>SqList<ElemType>:SqList(int size)elems=NULL;template<class ElemType>SqList<ElemType>:SqList()delete elems;template<class ElemType>/int SqList<Ele
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 小學(xué)音樂(lè)教育年度計(jì)劃
- 一年級(jí)數(shù)學(xué)上冊(cè)期末復(fù)習(xí)專項(xiàng)計(jì)劃
- 2025年中考英語(yǔ)作文命題趨勢(shì)及范文
- 幼兒園大班學(xué)習(xí)興趣培養(yǎng)計(jì)劃
- 2025銀行業(yè)廉潔談話記錄范文
- 個(gè)人原因辭職報(bào)告范文加班壓力大他
- 農(nóng)業(yè)種植勞動(dòng)力安排和材料投入計(jì)劃及其保證措施
- 節(jié)能環(huán)保系統(tǒng)集成項(xiàng)目工作流程
- 六年級(jí)畢業(yè)體育鍛煉規(guī)劃計(jì)劃
- 高中政治教育技術(shù)應(yīng)用心得體會(huì)
- 放射科實(shí)習(xí)入科培訓(xùn)
- 工業(yè)固體廢棄物的資源化處理
- 測(cè)繪儀器設(shè)備檢定、校準(zhǔn)管理制度
- 2024年電阻陶瓷基體項(xiàng)目可行性研究報(bào)告
- 大國(guó)兵器學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
- 24秋國(guó)家開(kāi)放大學(xué)《馬克思主義基本原理》專題測(cè)試參考答案
- 高一年級(jí)期末考試(生物)試題含答案
- 2024年新華東師大版七年級(jí)上冊(cè)數(shù)學(xué)全冊(cè)教案(新版教材)
- 項(xiàng)目管理培訓(xùn)課件(完整版)課件
- 2024年一級(jí)健康管理師考前沖刺必會(huì)試題庫(kù)300題(含詳解)
- 寧夏回族自治區(qū)寧夏吳忠市利通區(qū)2023-2024學(xué)年七年級(jí)下學(xué)期期末數(shù)學(xué)試卷
評(píng)論
0/150
提交評(píng)論