C++ if bug?

I'm a beginner working on my very first C++ project, a console/text based RPG.
I've ran into a problem though.

Ok, so at the first part of the game, it ask you to choose 1 out of 3 paths by typing the one of the numbers 1,2,3. I've been trying to make it so that each number path displays its own story.
I kinda got it to work...but not really.
This is the problem: It does not skip the number behind. i.e. you choose 2 it displays all the text in path 1 and THEN the text path 2, and if you choose 3 it displays all the text in path 1 and then path 2 and THEN path 3.
I guess I didn't build it right. I used if's like this if (quest1 = 1) for each one. The other problem is, I kept trying to use else and/or if else, but every time I did, it would pop up with an error "Expected a Statement"

Here is my Source code and header:
#include "vitalsma.h"
using namespace std;

int main ()
{
cout << "Vitalsma: Adventure - Presented by Bradley Robinson/ZAAL\n\n";
cout << "What is your name, young Warrior?\n";
cin >>name;
cout << "Well, ";
cout << name;
cout << ",\nYou are chosen by us spirits to rid the monsters, restore peace and avenge us.\n\n";
cout << "Take my Broadsword that I used until I perished.\n\n";
cout << "You are walking and the road splits into 3 paths\n";
cout << "Which path will you choose? (type 1, 2 or 3)\n";
cin >> quest1;
if (quest1 == 1);
{
cout << "As you enter the first path, you start to have unfamiliar\n";
cout << "thoughts of a Woman whom you know nothing of\n";
cout << "What do you think her name could be?\n";
cin >> womanname;
}
if (quest1 == 2);
{
cout << "As you walk the second path, you find a farm.\n";
cout << "There appears to be a a Thief robbing the farm while the farmer is\ntied up to the roof\n";
cout << "The Thief disturbingly has Red Eyes\n";
cout << "Red Eyed Thief:";
cout << name;
cout << ", the Dragon is waiting for you, he knows that were summoned to put an end to our plan to rule the world.\n";
cout << "Red Eyed Thief: Foolish your summoner was, thinking that a puny human such as yourself could stop this\n";
cout << "Red Eyed Thief: I'm stealing for the Dragon, but at this time, I'm sure he'll just want me to end your life now...\n";
}
if (quest1 == 3);
{
cout << "As you walk the third path, you smell fire...\n";
cout << "You see an Old Man running to you.\n";
cout <<"Old Man: You must help! Our town is on Fire! The Dragon came and attacked us with it's minions!";
}

system ("PAUSE");
return 0;
}








Header:


#include <iostream>
#include <string>
using namespace std;


string name;
string womanname;
bool quest1;
if (quest1 == 1);

remove the semicolon. same for the others

Learn what a compound statement is - Google
Topic archived. No new replies allowed.