Hello, I've been having a lot of trouble with a variable type called "float64". I'm trying to create a do{}while loop to make the number count up each time. data is also defined as an array.

float64		data[1];
int         i;
	do{
		for(i=0;i<1;i++)
		{
		data[i]=data[i]+.01;
		if(data[i]>9.99)
			data[i]=-9.99;
		}
}while('0'=='0');

Any guidance would be appreciated. Also, this MUST be float64, so no other variable can be substituted for it. Thank you.

Hello, I've been having a lot of trouble with a variable type called "float64". I'm trying to create a do{}while loop to make the number count up each time. data is also defined as an array.

float64		data[1];
int         i;
	do{
		for(i=0;i<1;i++)
		{
		data[i]=data[i]+.01;
		if(data[i]>9.99)
			data[i]=-9.99;
		}
}while('0'=='0');

Any guidance would be appreciated. Also, this MUST be float64, so no other variable can be substituted for it. Thank you.

Your instruction is not clear, what do you mean by "I'm trying to create a do{}while loop to make the number count up each time."

while('0'=='0');

...So it runs while the value of 0 is 0... :?:

The variable starts at zero, right? Then, I'm trying to make it count up .01 each time it goes through the loop. The if statement is for, when it reaches 10, it goes back to -10 and starts over.

...So it runs while the value of 0 is 0...

And that's only to make it continuous.

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.