coding problem

Game Editor comments and discussion.

coding problem

Postby nightFall16 » Wed Aug 03, 2016 3:15 pm

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
User avatar
nightFall16
 
Posts: 41
Joined: Wed Jun 22, 2016 4:24 am
Score: 2 Give a positive score

Re: coding problem

Postby DeltaLeeds » Wed Aug 03, 2016 7:09 pm

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. :)
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Re: coding problem

Postby nightFall16 » Mon Aug 15, 2016 8:00 am

hi ..thanks man it's working very will ,now my graduation project is going to be AWESOME !! :D :D :D
i love you man :)
User avatar
nightFall16
 
Posts: 41
Joined: Wed Jun 22, 2016 4:24 am
Score: 2 Give a positive score

Re: coding problem

Postby DeltaLeeds » Mon Aug 15, 2016 3:21 pm

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. ;)
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Re: coding problem

Postby nightFall16 » Mon Aug 15, 2016 8:23 pm

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
User avatar
nightFall16
 
Posts: 41
Joined: Wed Jun 22, 2016 4:24 am
Score: 2 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest