while(NotDivisbleYet=true && k<count)

could be:

while(NotDivisbleYet==true

and this line:

if(Prime2 = true)

could be:

if(Prime2 == true)

= is the assignment operator

== is the comparison operator

Good luck,

Jaime.

Solved

Posted on 2004-10-23

How do I let my program check that load_factor <= .75 when I have load factor as a double type but still returns zero instead of a decimal value? Here is the code I am running

while(NotDivisbleYet=true && k<count)

{

if(count%k==0)

{

NotDivisbleYet=false;

count++;

}

else

{

k++;

}

if(k>=count)

{

Prime2=true;

if(Prime2 = true)

{

load_factor=(n/count);

}

if( load_factor >= 0.75)

{

Prime2=false;

NotDivisbleYet=true;

count++;

k=2;

}

}

}

Thanks I am sure it is something easy and I am missing the answer

while(NotDivisbleYet=true && k<count)

{

if(count%k==0)

{

NotDivisbleYet=false;

count++;

}

else

{

k++;

}

if(k>=count)

{

Prime2=true;

if(Prime2 = true)

{

load_factor=(n/count);

}

if( load_factor >= 0.75)

{

Prime2=false;

NotDivisbleYet=true;

count++;

k=2;

}

}

}

Thanks I am sure it is something easy and I am missing the answer

4 Comments

while(NotDivisbleYet=true && k<count)

could be:

while(NotDivisbleYet==true

and this line:

if(Prime2 = true)

could be:

if(Prime2 == true)

= is the assignment operator

== is the comparison operator

Good luck,

Jaime.

cs

load_factor=(n/count);

If "n" and "count" are integers, then the result "n/count" will be an INTEGER, and then type-casted to double.

For example , 3/4 will produce (int)0 , type-casted to (double)0 !

Here it is not what you want !

So you should do this :

load_factor = ( ((double)n) / ((double)count) );

See ya

Ben

A C-String is a array of ascii values! :)

For example :

char sBuffer[1024];

FILE* fp;

fp = fopen("example.txt", "rt");

fgets(sBuffer, 1024, fp);

fclose(fp);

Now if the string read is "Hello world !", then sBuffer[0] will contain ascii code for 'H', sBuffer[1] will contain ascii code for 'e', etc.!

sBuffer[i] is a 'char' type, so it's a 1-byte integer.

You can try this with this sample code :

printf("%u", sBuffer[0]); // will print "72" in our example

Ben

By clicking you are agreeing to Experts Exchange's Terms of Use.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**14** Experts available now in Live!