- Joined
- Oct 5, 2001
- Location
- Ottawa, Canada
TC said:Well, if we're going to get that geeky I'll add this to help with the last post:
#include <stdio.h>
#include <string.h>
char *sDualStr;
int a, exp;
void main()
{
sDualStr= "";
a= 0;
exp= 128;
printf("\ndecimal -> 8-bit binary converter\n");
printf("\nGive me a Number(0-255):");
scanf("%d", &a);
if ((a>= 0) && (a<= 255)) {
while (exp> 0) {
if (a>= exp) {
strcat(sDualStr, "1");
a-= exp;
} else {
strcat(sDualStr, "0");
}
exp/= 2;
}
printf("\nThe 8-bit binary string: %s\n", sDualStr);
}
}
Allow me to translate into english:
Yodums owns, w00r!