hey, my names mike im 15 and i just bought this book beggininning c++ game programing, i have made a file that is supposed to after icompile and run open up the console window and let me input some data, now it does open up and let me input the data (3 things an even number a number less that that one and a warriors name) after i type in all of those it is supposed to take that information and fill in the blanks of a story that i have created with the given information but after i type in the infor and press enter the console windows disapears
here is the file i created tell me if there is anything i need to put in it or change
i am jus t a begininer and watever is typed there is all that i have learned pretty much in chapter 1 lol
//Firebreathing_dragon
//A Personalized Story
#include <iostream>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::string;
int main()
{
const int DRAGON_TEETH = 25;
int warriors, killed, survivors, half;
string leader;
//Get the information
cout << "Enjoy the fire breathing dragon\n\n";
cout << "Please enter the following information\n";
cout << "Enter an even number: ";
cin >> warriors;
cout << "enter a number, less than the first: ";
cin >> killed;
survivors = warriors - killed;
half = warriors/2;
cout << "Enter warriors name: ";
cin >> leader;
//tell the story
cout << "/nA brave group of" << warriors << "warriors set out on a journey";
cout << "To defeat the fire breathing dragon";
cout << "and get" << DRAGON_TEETH << "dragon teeth each";
cout << "To give to the king to prove thier loyalty to the town ";
cout << "When the " << warriors << " warriors discorvered the dragon";
cout << "they thought up a plan to defeat him.";
cout << "Thier plan was to have " << half << " of the warriors charge";
cout << "from the left side and the reamaining " << half << " warriors";
cout << "to charge from the right side/n";
cout << " unfortunately " << killed << " warriors were killed,";
cout << "in the battle against the fire breathing dragon.";
cout << " the remaining " << survivors << " took all the teeth,";
cout << "that the dragon had,";
cout << "it was plenty of teeth for the " << survivors << " to split up,";
cout << "and each have " << DRAGON_TEETH << "dragon teeth,";
cout << "to give the king./n";
return 0;
}

need help with console window closing to early
hsaelens
and this book i got doesnt say nutin bout dat cin at the end
mikn
Sagan33
Try adding the following two lines to the end of your program: they will force the program to stay around until you let it know that you have finished reading.
cout << "Press ENTER to continue ..." << std::endl;
cin.get();
return 0;
}