help with cond. and loop

hello
as the title said i'm having trouble understanding these
(i just started studying c++)

to cut to the chase here's my code

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
cout<<"\nEnter 'y' to start the game enter 'n' to exit";
cout<<"\n";
cin>>start;
if (start=='y')
{
	cout<<"\nyou've just woke up";
	cout<<"\nyou still feel sleepy";
	cout<<"\nWhat should you do first?";
	cout<<"\nEnter 'b' to brush your teeth and 'a' to eat your breakfast";
	cout<<"\n";
	cin>>choice1;
	if (choice1=='a');
	{
		cout<<"\nyou've decided to eat your breakfast first";
	}
	else if (choice1=='b');  ///here's where im having the problem misplaced else
	{

		cout<<"\nyou've decided to brush your teeth first";
	}
}
else if(start=='n')
{
	getch();
	return 0;
	}


i keep getting misplaced else error

and 1 more question how can i put a loop like this:

output is like this:

Enter y to start the game
sdadadada
wrong input try again.
y


you've just woke up.
Don't put semicolons after the condition on if statements or else-if statements, it doesn't do what you think.
fixed it
it's still showing the error :(
closed account (E0p9LyTq)
Did you fix both if (choice1 ==) statements?

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
28
29
30
31
32
33
34
#include <iostream>

using namespace std;

int main()
{
   char start;
   char choice1;
   
   cout << "Enter 'y' to start the game enter 'n' to exit: ";
   cin >> start;
   start = tolower(start);
   
   if (start == 'y')
   {
      cout << "\nyou've just woke up";
      cout << "\nyou still feel sleepy";
      cout << "\nWhat should you do first?";
      cout << "\nEnter 'b' to brush your teeth and 'a' to eat your breakfast: ";
      cin >> choice1;
      choice1 = tolower(choice1);
      
      if (choice1=='a')
      {
         cout << "\nyou've decided to eat your breakfast first\n";
      }
      else if (choice1 == 'b')
      {
         cout << "\nyou've decided to brush your teeth first\n";
      }
   }

   return 0;
}


Enter 'y' to start the game enter 'n' to exit: y

you've just woke up
you still feel sleepy
What should you do first?
Enter 'b' to brush your teeth and 'a' to eat your breakfast: b

you've decided to brush your teeth first
Topic archived. No new replies allowed.