I have created a class ShowTicket coded as follows in a header file:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
class ShowTicket {
public:
//function that returns true if sold status is true and false if it doesnt.
bool is_sold(void){
if (sold_status == true){
return true;
}
else{
return false;
}
}
//function that sets sold_status to true
void sell_seat(void){
sold_status = true;
}
//prints row, seat number and sold status in casual terms
string print_ticket(void){
ostringstream sout;
if(sold_status == true){
sout<<row<<" "<<seat_number<<"sold";
}
else{
sout<<row<<" "<<seat_number<<"available";
}
return sout.str();
}
//initilizes variables in constructor
bool sold_status;
const char* row;
const char* seat_number;
//constructor
ShowTicket(const char* row, const char* seat_number, bool sold_status){
sold_status = false;
}
};
I am using a main file with the following code to test this class
#include <iostream>
#include <string>
#include <sstream>
#include "showticket.h"
using namespace std;
int main () {
ShowTicket myticket1(“AA”,”101");
ShowTicket myticket2(“AA”,”102”);
if(!myticket1.is_sold())
myticket1.sell_seat ();
cout << myticket1.print_ticket() << endl;
cout << myticket2.print_ticket() << endl;
return 0;
}
I am receiving multiple "Use of undeclared identifier" errors and "Non-ASCII characters are not allowed outside of literals" errors and I do not know how to fix them.
Any help is greatly appreciated.