第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

編譯c++出錯:parse error before 'typedef',為什么?

編譯c++出錯:parse error before 'typedef',為什么?

手掌心 2022-05-12 16:11:45
#include<stdlib.h>#include"LinearList.h"const int defaultsize=100;template<class T>class Seqlist:public LinearList<T>{private:T *data;int maxsize;int last;void reSize(int newsize);public:Seqlist(int ms=defaultsize);~Seqlist(){delete[] data;}T* getData(int i){if(i>0&&i<last+1){return data[i-1];}void setData(int i,T& x){if(i>0&&i<last+1)data[i-1]=x;}//parse error before 'typedef'int Length(){renturn last+1;}int Search(T& x)int Size(){return maxsize;}void input()constvoid output()bool IsEmpty(){retnrn (last==-1)?true:flase;}int Locate(int i)bool Insert(int i,T& x)int Delete(int i)bool Remove(int i,T&x)Seqlist<T> operator=(Seqlist<T>&L)};template<class T>Seqlist<T>::Seqlist(int ms){if (ms>0){maxsize=ms;last=-1;data=new T[maxsize];if(data==NULL){cerr<<"存儲分配錯誤"<<endl;exit(1);}}}template<class T>Seqlist<T>::~Seqlist(){delete data;}template<class T>Seqlist<T>::Search(T& x){for(int i=0;i<maxsize;i++){if (data[i]==x)return i+1;return 0;}}template<class T>Seqlist<T>::input()const{cout<<"開始建立順序表,請輸入表中元素個數(shù):"<<endl;while(1){cin>>last;if(last==maxsize) break;cout<<"元素個數(shù)不能超過"<<maxsize-1<<endl;}for(int i=0;i<last;i++){cin>>data[i];cout<<i+1<<endl;}}template<class T>Seqlist<T>::output(){cout<<"輸出順序表中的元素:"<<endl;for(int n=0;n<last;n++){cout<<i+1<<":"<<data[i]<<endl;}}template<class T>Seqlist<T>::Locate(int i){cout<<"輸出元素a的位置:"<<endl;for(int m=0;m<last;m++){if (data[i]=='a')return (i+1);else return 0;}};template<class T>Seqlist<T>::Insert(int i,T& x){if (last==maxsize-1) return false;if(i<0||i>last)cout<<"不存在的元素位置:"<<endl;return false;for(int j=last;j>=i;j--)data[j+1]=data[j];data[i]=x;last++;return true;}template<class T>Seqlist<T>::Delete(int i){if(i<0||i>last)return false;// int x=data[i];for(int j=i;j+1<last;j++)data[j]=data[j+1];last--;return true;}
查看完整描述

2 回答

?
梵蒂岡之花

TA貢獻1900條經驗 獲得超5個贊

你的代碼沒有給全吧,
編譯都過不去啊。
根本編譯不到"parse error before 'typedef'"這一步,
編譯時直接#include"LinearList.h"找不到
是不是有頭文件沒給出

查看完整回答
反對 回復 2022-05-16
?
繁花如伊

TA貢獻2012條經驗 獲得超12個贊

void setData(int i,T& x){
if(i>0&&i<last+1)
data[i-1]=x;}//parse error before 'typedef'
int Length(){renturn last+1;}
int Search(T& x)
int Size(){return maxsize;}
void input()const
void output()
bool IsEmpty(){retnrn (last==-1)?true:flase;}
int Locate(int i)
bool Insert(int i,T& x)
int Delete(int i)
bool Remove(int i,T&x)
Seqlist<T> operator=(Seqlist<T>&L)
};



查看完整回答
反對 回復 2022-05-16
  • 2 回答
  • 0 關注
  • 639 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號