我正在尝试使用课程为大学课程编写基本的电梯模拟。现在 void CurrentFloor() 函数正在导致 C2365 和 C2063 错误,我不知道为什么,其他函数似乎已检出,但我无法弄清楚为什么这个特殊函数会导致这些错误。
#include <iostream>
#include <stdlib.h>
#include <iomanip>
using namespace std;
class elevator
{
private:
int StartFloor;
int NewFloor;
int currentFloor;
int requestedFloor;
char response;
public:
elevator(int floor = 0);
void CallElevator();
void CurrentFloor();
void RequestedFloor();
};
elevator::elevator(int f)
{
StartFloor = f;
f=1;
cout<<"The elevator is currently on the "<<StartFloor<<" floor";
}
void elevator::CallElevator()
{
cout<<"Would you like to call the elevator to your floor?: ";
cin>>response;
}
void elevator::RequestedFloor()
{
cout<<"What floor would you like to go to?: ";
cin>>requestedFloor;
}
void elevator::CurrentFloor()
{
cout<<"What is your current floor?";
}
int main()
{
elevator elevatorone(1);
return 0;
}