Sep 19, 2011 at 5:19pm Sep 19, 2011 at 5:19pm UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
int main ()
{
int max, black;
string death;
cout<< "Welcome to the dice rolling game\n" ;
cout<< "\n" ;
cout<< "Simply type /roll to play\n" ;
cout<< "\n" ;
cin>> death;
srand (time (0));
black = rand () % 20 ;max;
if (death == "/roll" )
{
cout<<"\n" ;
cout<<"\n" ;
cout<< "You rolled a " << black << endl;
cout<<"\n" ;
}
if (black < 10)
{
cout<<"\n" ;
cout<<"\n" ;
cout<<" Your warrior advances through the forest.\n" ;
}
else ;
{
cout<<"\n" ;
cout<<"\n" ;
cout<<" Your warrior has encountered three Skeletal Warriors.\n" ;
}
cin.ignore();
cin.get();
}
Everytime I run this program and I roll lower than a 10 instead of just the one statement appearing, both of them appear.
Any hints of help you guys could give me?
Last edited on Sep 19, 2011 at 5:20pm Sep 19, 2011 at 5:20pm UTC