I\'m having a problem with my code, can someone help me please. Here\'s my code:
ID: 3806616 • Letter: I
Question
I'm having a problem with my code, can someone help me please.
Here's my code:
#include <iostream>
#include <string>
using namespace std;
class Table {
public:
void SetSeatA( int personA );
void SetSeatB( int personB );
int GetSeatA();
int GetSeatB();
void SwapSeats();
void Print();
Table();
Table(int personA, int personB);
Table operator-(int person); // Removes person from table (sets seat to 0)
private:
int seatA;
int seatB;
};
Table::Table(){
seatA=-1;
seatB=-1;
return;
}
Table::Table(int personA, int personB){
seatA = personA;
seatB = personB;
return;
}
void Table::Print(){
cout << "Seat A = " << seatA << endl;
cout << "Seat B = " << seatB << endl;
return;
}
void Table::SetSeatA( int personA ){
seatA = personA;
return ;
}
void Table::SetSeatB( int personB ){
seatB = personB;
return ;
}
int Table::GetSeatA(){
return seatA;
}
int Table::GetSeatB(){
return seatB;
}
void Table::SwapSeats(){
int temp;
temp = seatA;
seatA = seatB;
seatB = temp;
return;
}
int main(){
Table t(100, 200);
t.Print();
t = t - 200;
t.Print();
return 0;
}
Explanation / Answer
Thank you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.