I am fairly certain that "age" is defined as an "int", but what is "race" defines as (what type)? Then is Vulcan a variable or a constant string? If it is a constant string it should be in quotes ("").
I think the first example is on the right track, but (Vulcan) and (Romulan) should be in quotes.
I had Vulcan and Romulan as a int so I changed it to a string and added the quotes but it came out to an error.
The error said "ISO C++ forbids comparison between pointer and integer.
// the requirement is met for anyone if
// the race is not Romulan and the age is 17 or more
bool requirements_met = (race!=Romulan) && (age>16) ;
// if age is 16, the requirement is also met provided the race is Vulcan
if( age==16 ) requirements_met = (race==Vulcan) ;
if( requirements_met )
{
// the requirement is met
// ...
}
else
{
// it not met
// ...
}
If you want a single-line version it would be the horrendously unreadable return ( ( race != "Romulan" ) && ( age >= 17 || ( race == "Vulcan" && age == 16 ) ) );
TBH, I'd be inclined to make your race an enum rather than a string, though.
Sorry for the delay, I could not stay up any later last night.
I believe you misunderstood my question. Without the rest of the program I could only guess at what the variable "race" was defined as and how "Vulcan" was being used. I can see now that putting "Vulcan" in quotes would give an error.
I would be inclined to type in the whole name, but with the "cin" expecting "race" to be input as a number "cin" would fail and no longer be usable in the rest of the program. If you want the user to enter a number than give that hint like "Human = 1". Just a thought.
I think the examples presented should give you an idea what needs to be done.