亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

運行有2個錯誤,麻煩高手們幫忙看看吧!

運行有2個錯誤,麻煩高手們幫忙看看吧!

呼啦一陣風 2022-04-22 15:11:43
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16Debug/car.exe : fatal error LNK1120: 1 unresolved externalsError executing link.exe.
查看完整描述

2 回答

?
慕標琳琳

TA貢獻1830條經驗 獲得超9個贊

這是我的停車場的程序,你看看吧:
#include <iostream>
#include<assert.h>
using namespace std;
struct CAR
{
int num;
int time;
};

class Stack
{
private:
int top,maxsize;
CAR *car_part;
public:
Stack();
Stack(int size);
~Stack();
int get_len(); //獲取停車場內的汽車數量
bool IsFull(); //停車場的車位是否滿了
bool IsEmpty(); //停車場是否有車停放
void push(CAR *pcar); //將車停入停車場
void pop(CAR* pcar); //將車開出停車場
int get_Rlen(); //查詢停車場還有幾個車位
int find(CAR *pcar); //查找某輛車并返回該車所在的位子
};
///////////////////////////////////////////////////
Stack::Stack(){}
Stack::Stack(int size)
{
assert(size>0);
top=-1;
maxsize=size;
car_part=new CAR[maxsize];
assert(car_part!=NULL);
}
Stack::~Stack()
{
delete[] car_part;
top=-1;
}
int Stack::get_len()
{
return top+1;
}
bool Stack::IsFull()
{
return (top+1==maxsize);
}
bool Stack::IsEmpty()
{
return (top==-1);
}
void Stack::push(CAR *pcar)
{
assert(!IsFull());
top++;
(car_part+top)->num=pcar->num;
(car_part+top)->time=pcar->time;
}
void Stack::pop(CAR* pcar)
{
assert(!IsEmpty());
pcar->num = (car_part+top)->num;
pcar->time = (car_part+top)->time;
top--;
}
int Stack::get_Rlen()
{ return (maxsize-top-1); }
int Stack::find(CAR *pcar)
{
int i=-1;//+++++++++++++++++++++++++++++++
while(++i <= top+1)
{
if((car_part+i)->num == pcar->num) return top-i;//+++++++++++++++++++++++
}
return -1;
}
////////////////////////////////////////////////////
class Queue
{
private:
struct td
{
CAR car;
td *link;
};
td *first,*last;
int curr_len;
public:
Queue();
~Queue();
void enQueue(CAR *pcar);
void outQueue(CAR *pcar);
int get_len();
bool IsEmpty();
int find(CAR *pcar);
void getcar(CAR *pcar);
};
///////////////////////////////////////////////////
Queue::Queue()
{
curr_len=0;
first=NULL;
last=first;
}
Queue::~Queue()
{
td *p;
while(first!=NULL)
{
p=first;
first=first->link;
delete p;
}
}
void Queue::enQueue(CAR *pcar)
{
td *p=new td;
assert(p!=NULL);
p->car.num=pcar->num;
p->car.time=pcar->time;
if(first == NULL)
first = p;
else last->link=p;
last=p;
last->link=NULL;
curr_len++;
}
void Queue::outQueue(CAR *pcar)
{
assert(!IsEmpty());
td *p;
p=first;
first=first->link;
if(first == NULL) last =NULL;//+++++++++++++++++++++++
pcar->num=p->car.num;
pcar->time=p->car.time;
curr_len--;
delete p;
}
int Queue::get_len()
{
return curr_len;
}
bool Queue::IsEmpty()
{
return (curr_len==0);
}
int Queue::find(CAR *car)
{
int j=0;
td *q=first;
while(q)
{
j++;
if(q->car.num==car->num) return j;
q=q->link;
}
return -1;
}
void Queue::getcar(CAR *pcar)
{
td *q=NULL,*p=first;
while(p!=NULL)
{
if(p->car.num == pcar->num)
{
if(p == first) first = p->link;//+++++++++++++++++++++++++
if (p == last )//++++++++++++++++++++++++++++
{
if( q == NULL)//++++++++++++++++++++++++++
{
last = NULL;
pcar->time = p->car.time;
delete p;
curr_len--;
break;
}
else
{
last = q;
pcar->time = p->car.time;
delete p;
curr_len--;
break;
}
}
if( q != NULL) q->link = p->link;//+++++++++++++++++++++++
pcar->time = p->car.time;
delete p;
curr_len--;
break;
}
q = p;
p=p->link;
}
}
void input(char a,int num,int time,Stack &carpart1,Stack &carpart2,Queue &tongdao)
{
assert(a=='a' || a=='A' || a=='D' || a=='d');
CAR q,p;
q.num=num;
q.time=time;
if(a=='a' || a=='A')
{
if(!carpart1.IsFull())
{
carpart1.push(&q);
}
else
{
tongdao.enQueue(&q);
}
}
else if(a=='d' || a=='D')
{
int i,j;

i=carpart1.find(&q);
j=tongdao.find(&q);
if(i!=-1)
{
for(int o=0;o<i;o++)
{
CAR tmpcar;
carpart1.pop(&tmpcar);
carpart2.push(&tmpcar);
}
carpart1.pop(&p);
while(!carpart2.IsEmpty())
{
CAR tmpcar;
carpart2.pop(&tmpcar);
carpart1.push(&tmpcar);
}
if(!tongdao.IsEmpty()){//++++++++++++++++++++++++++++++++++
CAR tmpcar;
tongdao.outQueue(&tmpcar);
tmpcar.time=time;
carpart1.push(&tmpcar);
}
cout<<"您的車號是"<<p.num<<endl;
cout<<"您的車是"<<p.time<<"點進入停車場的,現在的時間是:"<<time<<"點"<<endl;
cout<<"您應該付費:"<<((time-(p.time))*2)<<"元,謝謝您的惠顧!"<<endl;
}
else if(j!=-1)
{
tongdao.getcar(&q);
cout<<"您的車號是"<<q.num<<endl;
cout<<"您的車是"<<q.time<<"點到達的!"<<endl;
}
else
cout<<"沒有找到這輛車!"<<endl;
}
}
////////////////////////////////////////////////////////////
int main()
{
int sum,iput,num,findnum,time,o,w;
cout<<"************************歡迎進入停車場管理系統**************************"<<endl;
cout<<"***本系統的收費規則是在停車場內的收費為每小時2元,在通道內停車收費0元***"<<endl;
cout<<"********當停車場內有空的車位的時候我們會將您的車自動開入停車場!********"<<endl;
cout<<"輸入停車場的停車泊位數:"<<endl;
cin>>sum;
Stack carpart1(sum);
Stack carpart2(sum);
Queue tongdao;
iput=0;
while(iput!=6)
{
do{
cout<<"[1] 開 車 進 入 "<<endl;
cout<<"[2] 開 車 離 去 "<<endl;
cout<<"[3] 查詢停車場的剩余泊位 "<<endl;
cout<<"[4] 查詢當前停車通道中的汽車數量"<<endl;
cout<<"[5] 查詢特定車牌號的汽車位置 "<<endl;
cout<<"[6] 退出該停車系統 "<<endl;
cin>>iput;
}while(iput>6 || iput<1);
switch(iput)
{
case 1:
cout<<"請輸出您的汽車牌號:";
cin>>num;
cout<<"請輸入您的停車時間:";
cin>>time;
input('A',num,time,carpart1,carpart2,tongdao);
continue;
case 2:
cout<<"請輸入你要離去的車牌號:";
cin>>num;
cout<<"請輸入您離去的時間:";
cin>>time;
input('D',num,time,carpart1,carpart2,tongdao);
continue;
case 3:
cout<<"當前停車場內的汽車數量為:";
cout<<carpart1.get_Rlen()<<endl;;
continue;
case 4:
cout<<"當前通道內的汽車的數量為:";
cout<<tongdao.get_len()<<endl;;
continue;
case 5:
cout<<"請輸入您要查詢的車牌號:";
cin>>findnum;
CAR p;
p.num=findnum;
o=carpart1.find(& p);
w=tongdao.find(& p);
if(o>=0)
cout<<"您的車目前停放在停車場的"<<o<<"號泊位!"<<endl;
else if(w>=0)
cout<<"您的車目前停放在通道的"<<w<<"號泊位!"<<endl;
else
cout<<"當前沒有查訊到該車,請查證后再輸入!"<<endl;
continue;
case 6:
cout<<"歡迎您再次光臨!"<<endl;
system("PAUSE");
}
}
return EXIT_SUCCESS;
}
/*
input('A',1234,2,carpart1,carpart2,tongdao);
input('A',1235,3,carpart1,carpart2,tongdao);
input('A',1236,4,carpart1,carpart2,tongdao);
input('A',1237,5,carpart1,carpart2,tongdao);
input('A',1238,6,carpart1,carpart2,tongdao);
input('A',1239,7,carpart1,carpart2,tongdao);
input('A',1230,7,carpart1,carpart2,tongdao);
input('A',1231,7,carpart1,carpart2,tongdao);
input('D',1235,9,carpart1,carpart2,tongdao);
input('D',1238,11,carpart1,carpart2,tongdao);
input('d',1234,12,carpart1,carpart2,tongdao);
input('d',1235,13,carpart1,carpart2,tongdao);
input('d',1236,14,carpart1,carpart2,tongdao);
input('d',1237,15,carpart1,carpart2,tongdao);
input('d',1238,16,carpart1,carpart2,tongdao);
input('d',1239,17,carpart1,carpart2,tongdao);
input('d',1235,13,carpart1,carpart2,tongdao);
input('d',1236,14,carpart1,carpart2,tongdao);
input('d',1237,15,carpart1,carpart2,tongdao);
input('d',1238,16,carpart1,carpart2,tongdao);
input('d',1239,17,carpart1,carpart2,tongdao);
*/



查看完整回答
反對 回復 2022-04-24
?
收到一只叮咚

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

有可能是建立project的時候,選錯了工程類型,你這個應該是“Win32 Application”,結果卻選擇了該類型下面一個"Win32 Console Application"

查看完整回答
反對 回復 2022-04-24
  • 2 回答
  • 0 關注
  • 156 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

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

公眾號

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