So I want to go from having 0 or 1 to having words like false or true. I did it with an if statement earlier today, but I had to get rid of the whole bool thing. I made the variable just a float. But he requires we use bool. Here is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Car y;
cout << "Initial value for the Car: " << endl;
cout << "Age= " << y.getAge() << " years old. The Price= $" << y.getPrice() << endl;
y.setAge(8);
y.setPrice(12000);
y.setRaceCarStatus(true);
cout << "Modified value for the Car: " << endl;
cout << "Age= " << y.getAge() << " years old. The Price= $" << y.getPrice() << endl;
*cout << "Race Car Status= " << y.getRaceCarStatus() << endl;
//y.getRaceCarStatus
//if(y.getRaceCarStatus==true)
//{cout << "Race Car Status= True" << endl;}
//else
//{cout << "Race Car Status= False" << endl;}
cout << " " << endl;
I commented (//) the if statement that I had earlier. If I set RacecarStatus to True, is cout's 1. The starred (*) line right above the comments is the line that I was required to add. I want to cout the actual word true.
Can someone please help me with the if statement? The one I had this morning won't work anymore.