Hello, i'm a long time lurker, first time posting...
i have 2 problems really,
This next block of code is part of a sorta, dice roller thats rolls 7 20 sided dice, but only rolls numbers between 10 and 20. what i want is to put each roll into a variable to be used later in the program
Code:
high = 20;
cin.get();
cout << "Here are your rolls: " << endl;
for (int x = 0; x < 7; x++) {
die = rand() % (high - 10 + 1) + 10;
cout<< die << endl;
}
cout << endl;
my next thing is, for some reason cin.getline(); is not working.. here's the code i used
Code:
char backstory[2000];
cout << "Please enter your your character's backstory, if any: ";
cin.getline(backstory, 2000, "/n");
the backstory variable is decalred on the top of the code, while the next part is near the end. when i run the program it works fine up to any cin.getline().. it actually skips it and moves on to the next line
it lookes like this:
Code:
Please enter your character's first name: [userinput]
Please enter your character's last name: [userinput]
Please enter your character's backstory: [this part is skippped and goes to next line]
Please press any key to continue....
Any ideas on both problems?