You appear to be invoking double as a function when in fact it is a type definition. Without the parens, the compiler is interpreting double as a type definition, and this is a syntax error on the right side of an equal sign.
When you put the double in parenthesis, you are using it as a type cast, causing the result of the operation to its right to be cast as a double.
I'm not sure what you are trying to do really, but it looks to me like you should define some new variables as type double, then perform your rand() functions to these double variables, then perform your division operations using the doubles. The output will then naturally be a double unless you cast it to something else.
|