#include <stdio.h>
#include <math.h>
/* converts to binary */
int main()
{
unsigned int decimalNUM = 0;
printf("Enter a number to be converted to binary.\t");
scanf("%d", &decimalNUM);
fflush(stdin);
baseConv(decimalNUM);
getchar();
return 0;
}
baseConv(unsigned int n){
if (n == 0) ;
while (n > 0){
printf("%d", n%2);
n = n >> 1;
}
return 0;
}
我知道如何現在這樣做,但它向後打印。我將如何去扭轉它?向後打印此二進制代碼。在C
步驟1:在發佈代碼之前,修復編譯器警告。第2步:在你的問題中包含代碼 - 除非它比這更多的行。 – 2011-02-04 04:15:38
編譯器警告...?! – tekknolagi 2011-02-04 04:28:51