Page 1 of 1

coding problem

PostPosted: Wed Aug 03, 2016 3:15 pm
by nightFall16
hi .. i started a new project using GE and is out of games ranges
i made an app that's calculates the maximum momentum that the concrete can handle
but in the middle of my work a faced a problem .. i want to find (C) value , while(C) is a variable
from this equation 0.85*fc*B*C= As*600((D-C)/C)
so i used the following code but the GE crashes when i start the game(the app )
the code :
int i
double right = As*600((D-C)/C);
double Left = 0.85*fc*B*C;
double Find;
for (i=1;i<1000;i+=0.1)//while c can't reach 1000 and may have some below 1 values
{
right = As*600((D-i)/i);
Left = 0.85*fc*B*i;
find = right - Left;
if (find == 0)C = i;
else{}

}
please help me fast and THANKS

Re: coding problem

PostPosted: Wed Aug 03, 2016 7:09 pm
by DeltaLeeds
Code: Select all
int i
double right = As*600((D-C)/C);
double Left = 0.85*fc*B*C;
double Find;
for (i=1;i<1000;i+=0.1)

The variable i is int, but you want it to add it by 0.1 in the loop... This will make an infinite loop as adding by 0.1 in int is adding by 0, thus it would loop infinitely because 1 will never increase and will always be less than 1000... Try to make i a float or make the increment to i++ instead of i+=0.1...

Also...
Code: Select all
if (find == 0)C = i;
else{}

You don't really need else if there's nothing happening when find is not 0.

I hope I helped. Tell me how it goes. :)

Re: coding problem

PostPosted: Mon Aug 15, 2016 8:00 am
by nightFall16
hi ..thanks man it's working very will ,now my graduation project is going to be AWESOME !! :D :D :D
i love you man :)

Re: coding problem

PostPosted: Mon Aug 15, 2016 3:21 pm
by DeltaLeeds
nightFall16 wrote:hi ..thanks man it's working very will ,now my graduation project is going to be AWESOME !! :D :D :D
i love you man :)


Glad to help your graduation project. ;)

Re: coding problem

PostPosted: Mon Aug 15, 2016 8:23 pm
by nightFall16
thanks , may i ask another favor ??
this app i'am working on i want to make it for android so what i really need here is sdk manager and my bad luck after i download it
i didn't find the build tool as in lcl'c tutorial so i want to know how to get these build tools and platform and stuff
so if some could attach the exact files or post media fire link for the sdk so i can complete my work
AND THANKS ALL OF YOU GUY for everything