My program needs to accept various user input. Some of those numbers are to be doubles (between 0 and 1). Even though I enter a conforming number (like 0.4 or just .4), the assert functions fail. This jumps around a bit, but here are the relevant lines:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int main()
{
...
Program_Constants my_const;
cout << "Enter a decimal between 0.00 and 1.00: ";
cin >> str;
arrival_prob = verify_double(str);
str.clear();
cin.clear();
my_const.set_arrival_prob(arrival_prob);
...
run_sim(my_const)
}
The problem has to be somewhere after those assertions. Somewhere along a data type or something could be different. Otherwise I see nothing wrong with the code.
Thanks for looking at this. You're right, this code was fine. I found the problem in my set functions. I need some work on my debugging skills. Sorry to waste your time on this, but confirming the code was very helpful.