頁:
[1]
十進位換算二進位_C語言
http://codepad.org/fi0xpSdE]code碼////////////////////用C語言
如上 輸入0~255的整數換算成二進位 下面不知道該怎麼打 請高手協助!!
<div></div>
void printb( unsigned char c )
{
unsigned char tmp=1<<7;
while(tmp>0)
{
print f("%u",((c&tmp)!=0));
tmp>>=1;
}
print f("\n");
}
本帖最後由 Invi6666 於 2012-12-5 10:25 PM 編輯
你的程式要轉換成二進制需要什麼條件嗎?如果沒有那就直接用 itoa 這個涵式就行了#include <stdio.h>
#include <stdlib.h>
int main()
{
int n=0;
char s;
scan f("%d",&n);
itoa(n,s,2);
print f("%s\n",s);
system("pause");
}
懇求高手解疑惑!10位數字轉6位數算法?
http://www.eyny.com/thread-13647332-1-1.html
頁:
[1]