I've been experimenting with this method for the last five minutes and it hasn't properly produced what exactly I want. I want a program that outputs 10 random decimal numbers. All of the decimal numbers should be lower than 2.00, meaning, that some of the numbers that actually get placed on screen(output) should be like:
1.91
0.19
0.45
etc.
Well, enough talking. Let me paste what I've done. I hope the next person that post can come up with a quick, peaceful(not bashful) solution.
Code:#include <iostream> #include <stdlib.h> #include <time.h> int main() { double number; for(int i=0; i<=10; i++) { number= (rand() % 1) + ( (rand() % 99) * 0.10); cout << number << endl; } cin.get(); return 0; }