Im having a problem with some of this code

I am getting the error comparison between distinct pointe types std::string with this code

if(energy <= gymc3){
cout << "If you work out any further you could possibly die from a heart attack\nAre you sure you want to keep working out? Y/N" << endl;
cin >> gymc4;
if(gymc4 == 'y' || gymc4 == 'Y'){
string deadono[] = {"Heart Attack", "Your Still Alive"};
string gymc5 = deadono[rand()%2];
if(deadono == "Heart Attack"){
cout << "You had a Heart Attack from working out too hard, You are dead" << endl;
}
}
}
So first don't give us the full code, so we have no idea what type of variables we are looking at.
Then you decide that writing "error comparison" will give us more information about the error than your compiler. Genius!

1. Post full relevant code that reproduces the problem.
2. Post actual errors.
3. Edit your post and use code tags - http://www.cplusplus.com/articles/jEywvCM9/
TarikNeaj Is correct

Guessing at the rest of your code, I would say you are possibly using a string instead of a char for gymc4- in which case you would change 'y' and 'Y' to "y" and "Y"
1
2
3
string deadono[] = {"Heart Attack", "Your Still Alive"};
string gymc5 = deadono[rand()%2];
if(deadono == "Heart Attack"){

deadono is an array, at line 3 you can't compare it to a string. I think you meant
if (gymc5 == "Heart Attack"){
Im sorry tarik im kindof new to posting code errors
Well, that's why there is a Read before posting - http://www.cplusplus.com/forum/beginner/1/
Topic archived. No new replies allowed.