Hi all,

I'm new to C++ and am having a problem with a piece I am writing for an assignment. The problem area is below.

//arrival process on the corporate links
    if (clock % 4 == 0) 
    {
    
double randomno
    randomno = randgen; // Generate random number
    
    if (randomno /100 <= p3) queue = queue + 3;

randgen will generate a random number, it has a variable double register random

Problem is with line randomno = randgen ........
The error is 104 .cpp cannot convert `double ()()' to `double' in assignment

Any help much appreciated!!

you need to add the parentheses so that the compiler will know it is calling a function.

randomno = randgen(); // Generate random number

>>it has a variable double register random
do you mean you declared it like this ??:

register double  random;

All of the compilers I have used over the years only allow register keyword for integers (short, int and long). And today most compiler will ignore the register keyword altogether. There is no requirement for a compiler to honor that keyword.

Hi,

Thanks Ancient Dragon, this solved the problem.

I didn't write the function I was calling, and it had double register random, which I thought might be important as I didnĀ“t know what it meant.

The function I am calling was written in C, if that makes a difference.

Thanks once again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.