help Else IF statements

heres my code
#include <iostream>
#include <string>
using namespace std;

int main()
{
string exercise;

cout << "Please enter an exercise: ";
getline(cin,exercise);
if( exercise == "curl" || exercise == "chinup")
{
cout << "This exercise is for your biceps. ";
}
else if(exercise == "pushup" || exercise == "press")
{
cout << "This exercise is for your pecs. ";
}
else if(exercise == "row")
{
cout << "This exercise is for your back. ";
}
else if(exercise == "dead lift")
{
cout << "This exercise is for your whole body.";
}
}
i need to make it so that when i put in dead lift as 2 words the program excutes correctly
If u want to compare two words than u need to use string compare function.
Or u can assign the value to each exercise so that user can insert a value.
Topic archived. No new replies allowed.