Help me please. I don't know where the error is.
If you find it i will appreciate it. Very much.

It says its inhere somewhere :

else (ENEMIES > ADVENTURERS)
   {
   cout << "\nAlong the way a band of Ogres ambushed the party. ";
   cout << "All fought bravely under the command of " << LEADER;
   cout << "But still, they were defeated.";
   }

Here is the whole code :

//The Story

#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::string;

int main()
{
    const int GOLD = 1200;
    int ADVENTURERS, ENEMIES, SURVIVORS;
    string LEADER;
    
// Player Info
   cout << "Welcome to the Treasure Hunt\n" ;
   cout << "Please enter the following\n\n" ;
   
   cout << "Enter your name: ";
   cin >> LEADER;
   
   cout << "Enter group size: " ;
   cin >> ADVENTURERS;
   
   cout << "Enter the number of enemies: " ;
   cin >> ENEMIES;
   
   SURVIVORS = ADVENTURERS - ENEMIES;
   
//Telling the story
   
   cout << "\n\nA brave group of " << ADVENTURERS << "set out on a Treasure Hunt. ";
   cout << "They were after the lost treasure of the Ancient Dwarves. ";
   cout << "The group was led by a legendary leader, " << LEADER << ". \n";
   if (ENEMIES < ADVENTURERS)
   {
   cout << "\nAlong the way a band of Ogres ambushed the party. ";
   cout << "All fought bravely under the command of " << LEADER;
   cout << ", and the Ogres were defeated, but at a cost of " << ADVENTURERS - ENEMIES <<" great men.";
   cout << "The party was about to give it all up, when they stumbled upon the treasure. They found " << GOLD << " gold pieces.";
   cout << " Each party member got" << GOLD / SURVIVORS << " gold pieces.";
   }
   else (ENEMIES > ADVENTURERS)
   {
   cout << "\nAlong the way a band of Ogres ambushed the party. ";
   cout << "All fought bravely under the command of " << LEADER;
   cout << "But still, they were defeated.";
   }
   cin.ignore();
   return 0;
   cin.get();
}

hi,

you can't do like this

else (ENEMIES > ADVENTURERS)

chang it to this

else if (ENEMIES > ADVENTURERS)

good luck

Or perhaps just leave it as

else

you can use else if(condition) or else.

Hi!
Thanks for your help, but now a new problem appears.
I put in the

cin.get()

and

cin.ignore()

line, and now i don't know why but the first letter/number from the input dissapears :S

help please

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.