#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <string>
using namespace std;
int main()
{
bool test1, test2, test3;
int ourStrength = 10, goblinStrength = 5, trollStrength = 10, cyclopsStrength = 15;
cout << "Welcome to the strength game\nYou walk into a cave and spots a goblin\n";
cout << "do you engage? (1 for yes, 0 for no)\n";
cin >> test1;
if (test1)
{
cout << "you engage the goblin in combat\n";
if (ourStrength > goblinStrength)
{
cout << "You easily beat the goblin\n";
}
else
{
cout << "You are not as strong as the goblin!\nGAME OVER";
system("PAUSE");
}
}
else
{
cout << "As you walk away the goblin throws a rock at the back of your head and you die\nGAME OVER";
system("PAUSE");
}
cout << "You walk into a deep forest and spots a troll\n";
cout << "Do you engage in combat? (1 for yes, 0 for no)\n";
cin >> test2;
if (test2)
{
if (ourStrength == trollStrength)
{
cout << "You and the troll walks each ways because no one can win\n GZ YOU WIN THE GAME!";
system("PAUSE");
}
else (ourStrength < trollStrength)
{
cout << "The troll easily beats you\";
system("PAUSE");
}
}
else
{
cout << "troll kills you as you walk away"
system("PAUSE");
}
}
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <string>
using namespace std;
int main()
{
bool test1, test2, test3;
int ourStrength = 10, goblinStrength = 5, trollStrength = 10, cyclopsStrength = 15;
cout << "Welcome to the strength game\nYou walk into a cave and spots a goblin\n";
cout << "do you engage? (1 for yes, 0 for no)\n";
cin >> test1;
if (test1)
{
cout << "you engage the goblin in combat\n";
if (ourStrength > goblinStrength)
{
cout << "You easily beat the goblin\n";
}
else
{
cout << "You are not as strong as the goblin!\nGAME OVER";
system("PAUSE");
}
}
else
{
cout << "As you walk away the goblin throws a rock at the back of your head and you die\nGAME OVER";
system("PAUSE");
}
cout << "You walk into a deep forest and spots a troll\n";
cout << "Do you engage in combat? (1 for yes, 0 for no)\n";
cin >> test2;
if (test2)
{
if (ourStrength == trollStrength)
{
cout << "You and the troll walks each ways because no one can win\n GZ YOU WIN THE GAME!";
system("PAUSE");
}
else if (ourStrength < trollStrength) // You need to use the "else if" statement here
{
cout << "The troll easily beats you\n"; //You forgot the "n"
system("PAUSE");
}
}
else
{
cout << "troll kills you as you walk away"; //You forgot the semicolon
system("PAUSE");
}