All pastes #537943 Raw Edit

LordBoBCUP

public text v1 · immutable
·published 2007-06-04 22:06 UTC
rendered paste body
void division(int intInputDividend, int intInputDivider, int FloatingPointArray[], int count){
	double result, divider, dividend, remainder;													/* standard variable initalisation - pretty self explanatory*/
	int loop, count1;
	count1 = 0;
	dividend = intInputDividend;
	divider = intInputDivider;
	count = count + 1;


	while ((result = dividend - divider) != 0 && count != 0 ){	/*checks to see if the remainder isn't equal to zero, and it has not reached the length of required doubleing points*/
		if (result < 0){
			FloatingPointArray[count1] = 0;
			while (count != 0){
				for (loop = 1; (result >= divider); loop++){
					result = result - divider;							/* calculates the actual remainder from each time round the loop*/
				}
				FloatingPointArray[count1+1] = loop;
				count = count -1;
				++count1;
			}
			return;
		}
		for (loop = 1; (result >= divider); loop++){
			result = result - divider;							/* calculates the actual remainder from each time round the loop*/
		}
		remainder = result;
		FloatingPointArray[count1] = loop;						/* stores the result into the array*/
		count = count - 1;										/* decrement count*/
		++count1;												/* increment second counter*/
		if (remainder == 0){
			while (count != 0){
				FloatingPointArray[count1] = 0 ;
				count = count -1;
				++count1;
			}
			break;

		}
		if (remainder < 1){
			dividend = remainder;

		}
		if (remainder > 100 && remainder < 1000){
			dividend = remainder * 100;

		}
		if (remainder > 0 && remainder < 100){
			dividend = remainder * 10;								/*prepare the dividend for the next time around the loop*/

		}
		if (remainder > 1000 && remainder < 10000){
			dividend = remainder * 1000;

		}
	}

}