Else without previous if error

Write your question here.
Hello, I am new to C++, but i have learned the basics. im trying to find a way to ask if the person inputted the right thing, if so, appraise, and if not, disprove. i built it, but i get the error: "else without a previous 'if'" but if you look down to line 18, where the else is, I have an if above it. any pointers on how to fix this?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    string Yes;
    Yes = "Yes";
    cout << "Hello! Input Yes to continue!" << endl;
    string YesTest;
    cin >> YesTest;
     if (YesTest == Yes);
     {
        cout << "Well done!";
     }
     else;
     { cout << "Sorry, you need to enter 'yes'.";
     }
     return 0;
     }
Lines 14 and 18 should not end with a semicolon.
Tanks Chervil! That indeed fixed the problem. im actually going to use this for a future game i will make!
Topic archived. No new replies allowed.