Else IF statements

Pages: 123
u are awsome that fixed the error on the if side of the code but my else's are still underlined as errors
That's because you have single quotes around your literals in your else ifs as well.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string exercise;

	cout << "Please enter an exercise: ";
	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";
	}
}

this is my code as it stands i dont completly understand what you just said
what lines are the current errors on?
15,19,23
try taking out the else part, or is that required for the project?
its needed for the program to run correctly
you using Microsoft visual I take it
yep
try replacing else if with elif it works.in python not sure about C++
no didn't work
so what does the error say now, don't copy and paste tell what's in quotes
Your problem is you have ';' after all your if/else if statements, remove them and it will work fine.
remove the semi-colons ';' from the end of your if and else if conditionals.

 
	if( exercise == "curl" || exercise == "chinup");


Those don't belong there.
Last edited on
wow good job fire draco didn't see that
did it work?
im trying it right now we'll see
yeah it works perfictly thank you to all of you who helped me on this i appreciate it
only one thing more to ask how can i get deadlift to go in as 2 words?

thats alot more complexity for little gain trust me
if you really want some kind of separation try putting a _
Pages: 123