Original Post
Ok once again thanks alot to the people that helped out a few days ago. All suggestions where welecome and apperciated. Now ive got a function up and running for my neon problem with transformers It has a run time problem now. When I run it the program pasues for a bit then crashes. Im going to post my code while i continue to work on it. See if any one can spot some thing wrong with it. Again when run it pauses then crashes. Any help is welcome.
/*Takes in the length of neon for a sign, also takes in two adresses. Find thes
2 transformers that best match the length of neon then uses the pointers
to make there value change in the main program*/
float transformers (float neon_length, int *transformerA_ptr, int *transformerB_ptr)
{
/*x and y are used as counters to cycle though the transformers
total support is test varible to see if the two transformes get
close to adding up to the neon footage*/
int x,y,total_support;
x=0;
y=0;
/* This loop takes the neon footages and tests it with the first possible
and lowest combination of transformers, then works up with the first lowest
being added to the next highests. If that does not meet the reqiurments the
inside loop breaks and the oustide loop makes the first transformer go up
to the next one, and the inside loop goes again. untile a suitble match is found.*/
while(1)
{
y=0;
while(1)
{
total_support = 0;
total_support = transformer[x] + transformer[y];
if ( y >= 11)
{
break;
}
if (total_support == neon_length or total_support == neon_length+1 or total_support == neon_length+2 or total_support == neon_length+3)
{
break;
}
++y;
}
if (total_support == neon_length or total_support == neon_length+1 or total_support == neon_length+2 or total_support == neon_length+3)
{
break;
}
++x;
}
*transformerA_ptr = x;
*transformerB_ptr = y;
return(0);
}