No need for AssignValue to be a friend function unless it is a requirement of the assignment.
How will AssignValue know how many digits to place before and after the decimal point? 123.456 0.123456 and 123456.0 are all valid float/doubles variables. Passing both values to the function would be one way. Generating random values would be another. Asking for user input from within the function would be a third. Whatever floats your boat is what you should use.
Using dynamic memory rather than static will allow user/program to specify the above values randomly. You can limit the number of significant digits if you wish.
Reputation Points: 718
Solved Threads: 373
Nearly a Posting Maven
Offline 2,253 posts
since Jul 2005