#include <stdio.h>
#include <stdlib.h>
int count_one_bit(unsigned int num)
{ int count=0;
while (num)
{
if (num % 2 == 1)
count++;
num = num / 2;
}
return count;
}
int main()
{ int ret=count_one_bit(255);
printf("%d\n", ret);
system("pause");
}
這個程序其實是C語言中很簡單的一個,但是在和同學討論的時我還是感覺自己有一些細節沒有很清楚,這就代表我的C語言基礎還是不扎實。所以,我感覺要學好一門語言一定要把基礎打好,不在乎學得多,但是一定要消化好學過的知識。還有要多動手,這樣才能找出問題才會知道需要學的還很多。 這是我的第一篇博客,這些話其實更多的是給自己說的,只有自己做到了才有資格說給別人。共勉,加油。