[Solved] Code not working? [closed]


To start with, get rid of yes and no, which make no sense, and read the input into a string variable:

string Rated;
cin >> Rated;

then to use that, remember to use == not = for comparison:

if (Rated == "yes") {/*whatever*/}

Alternatively, use a boolean variable:

string yes_or_no;
cin >> yes_or_no;
bool Rated = yes_or_no == "yes";

if (Rated)  {/*whatever*/}

Also, this:

8 <= hour <= 24

doesn’t do what you think it does. You’d need two separate comparisons:

8 <= hour and hour <= 24

although, in this case, you don’t want it at all – it doesn’t make sense to initialise hour with that. You’re reading the value of hour and checking its range later, and don’t need to initialise it here.

There are probably more problems, but that should get you started. And I hope I can still go to the cinema when I’m over 100.

solved Code not working? [closed]