I dont know why this dosent work?????

Started by
16 comments, last by ssj2 21 years ago
It closes because like Pipo said you need to add system("PAUSE") to the end. This will add a "Press any key to continue..." prompt at the end of your program. To make the program ask again after you enter a 0, you need tu use a loop. I would do something like this:

int sides = 0std::cout << "select the number of sides you want to roll!";  while (sides <= 0){   std::cin >> sides;   if(sides > no)   {      ...   }   else if(sides <= no)   {      std::cout << "try again buddy!:/n";   }}system("PAUSE"); 


[edited by - Wrudyn on May 1, 2003 4:06:01 PM]
Advertisement
Thanks much everyone it works pretty well now.
Sorry... didn't notice that you are done with it...

[edited by - newbiegamer on May 1, 2003 5:35:21 PM]
Cheers!!!V!
Ummm...Why dont you add "using namespace std;" so you dont have to add std:: before all you cin''s and cout''s? It takes a heck of a lot less time
BoC HomepageLuck is a Horse to ride like any other...Luckily im not a gambler, I dont know how to ride.
quote:Original post by Betrayer_of_Code
Ummm...Why dont you add "using namespace std;" so you dont have to add std:: before all you cin''s and cout''s? It takes a heck of a lot less time

You shouldn''t use the line

using namespace std;

When you do that all function, classes, and variables that are within std namespace are now avaialable. You will eventually run into the same problem that was resolved by putting the standard in the std namespace! Your just opening up the doors to global name polution.

Get into the habit of doing this

using std::string;
How can you get name conflics by using the whole standard namespace?
grr... std::string!! raw pointers all the way!
He means conflicts between code in the std namespace and code that is in other namespaces, or not in a namespace at all.

Really,
using namespace std 
defeats the whole point of using namespaces in the first place.

[edited by - MDI on May 2, 2003 3:45:09 PM]

This topic is closed to new replies.

Advertisement