条理清晰,封装合理,测试完整,linux GCC
#include <stdio.h>
typedef enum boolean{FALSE, TRUE}BOOL;
//this function is to find a natural num within 3,whoes
//7 decimal is the reverse to 9 decimal.
//function to calculate a Natural num to a decimal low euqal than 10.
//num the num that to be dealed.
//whichDecimal what type of data you want such as HEX OCT or binary.
int ExchangeDecimal(int num, int whichDecimal)
{
int tmp = 0;
int multiRate = 1;
while(num > whichDecimal)
{
tmp += (num % whichDecimal)*multiRate;
num = num / whichDecimal;
multiRate *=10;
}
tmp += num * multiRate;
return tmp;
}
//reverse num
int ReverseNum(int num)
{
int cookData = 0;
while(num > 0)
{
cookData *= 10;
cookData += (num%10);
num = num / 10;
}
return cookData;
}
//find the num and print the num
//num to be dealed ,num no big than 999 is required.
BOOL FindData(int num)
{
i


1321

被折叠的 条评论
为什么被折叠?



