/********************************************************************************************
05-b.cpp
Generate a file full of random numbers
********************************************************************************************/
#include <iostream>
#include <string>
using namespace std;
#include <fstream>
#include <time.h>
#include <math.h>
void main()
{
time_t t;
srand((unsigned) time(&t));
int howMany, maxValue, maxDigits;
cout << "Enter how many numbers to generate: ";
cin >> howMany;
cout << "Enter the maximum value for the numbers: ";
cin >> maxValue;
cout << "Enter the maximum number of digits to the RIGHT of the decimal: ";
cin >> maxDigits;
cout << "modulus of: " << maxValue * (int)pow(10, maxDigits);
string input;
cout << "Enter the path\\name for the file: ";
cin >> input;
ofstream fout(input.c_str());
int NewNumber;
float digitFactor = (int)pow(10, maxDigits);
for (int i = 0; i < howMany ; i++)
fout << (rand() % maxValue) + (rand()%(int)digitFactor) / digitFactor << endl;
}