showCard(intx,inty,unsignedcharnuelseif(c>='0'

小猫鱼1182022-10-04 11:39:541条回答

showCard(intx,inty,unsignedcharnuelseif(c>='0'
DWORDAckNo;t(hWnd,

已提交,审核后显示!提交回复

共1条回复
heihei1123 共回答了18个问题 | 采纳率83.3%
UDP;cpuPoker[0][13].num=0;比方return;mLaunchServicePI
1年前

相关推荐

单片机51的C程序谁给解释下?#include #include unsigned char code displayb
单片机51的C程序谁给解释下?
#include
#include
unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f};
unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,0x00,0x40};
unsigned char code dotcode[32]={0,3,6,9,12,16,19,22,
25,28,31,34,38,41,44,48,
50,53,56,59,63,66,69,72,
75,78,81,84,88,91,94,97};
unsigned char displaycount;
unsigned char displaybuf[8]={16,16,16,16,16,16,16,16};
unsigned char timecount;
unsigned char readdata[8];
sbit DQ=P3^7;
bit sflag;
bit resetpulse(void)
{
unsigned char i;
DQ=0;
for(i=255;i>0;i--);
DQ=1;
for(i=60;i>0;i--);
return(DQ);
for(i=200;i>0;i--);
}
void writecommandtods18b20(unsigned char command)
{
unsigned char i;
unsigned char j;
for(i=0;i0;j--);
DQ=1;
}
else
{
DQ=0;
for(j=2;j>0;j--);
DQ=1;
for(j=33;j>0;j--);
}
command=_cror_(command,1);
}
}
unsigned char readdatafromds18b20(void)
{
unsigned char i;
unsigned char j;
unsigned char temp;
temp=0;
for(i=0;i0;j--);
if(DQ==1)
{
temp=temp | 0x80;
}
else
{
temp=temp | 0x00;
}
for(j=200;j>0;j--);
}
return(temp);
}
void main(void)
{
TMOD=0x01;
TH0=(65536-4000)/256;
TL0=(65536-4000)%256;
ET0=1;
EA=1;
while(resetpulse());
writecommandtods18b20(0xcc);
writecommandtods18b20(0x44);
TR0=1;
while(1)
{
;
}
}
void t0(void) interrupt 1 using 0
{
unsigned char x;
unsigned int result;
TH0=(65536-4000)/256;
TL0=(65536-4000)%256;
if(displaycount==2)
{
P0=displaycode[displaybuf[displaycount]] | 0x80;
}
else
{
P0=displaycode[displaybuf[displaycount]];
}
P2=displaybit[displaycount];
displaycount++;
if(displaycount==8)
{
displaycount=0;
}
timecount++;
if(timecount==150)
{
timecount=0;
while(resetpulse());
writecommandtods18b20(0xcc);
writecommandtods18b20(0xbe);
readdata[0]=readdatafromds18b20();
readdata[1]=readdatafromds18b20();
for(x=0;x255)
{
readdata[1]++;
}
}
readdata[1]=readdata[1]4;
x=x & 0x0f;
readdata[1]=readdata[1] | x;
x=2;
result=readdata[1];
while(result/10)
{
displaybuf[x]=result%10;
result=result/10;
x++;
}
displaybuf[x]=result;
if(sflag==1)
{
displaybuf[x+1]=17;
}
x=readdata[0] & 0x0f;
x=x
就是用DS18B20进行温度检测
susancan1年前3
郑沪生 共回答了19个问题 | 采纳率94.7%
unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f};定义数码管显示位选数组
unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,0x00,0x40};定义共阴极数码管显示编码数组
unsigned char code dotcode[32]={0,3,6,9,12,16,19,22,
25,28,31,34,38,41,44,48,
50,53,56,59,63,66,69,72,
75,78,81,84,88,91,94,97};定义ds18b20表格数组
unsigned char displaycount;定义变量
unsigned char displaybuf[8]={16,16,16,16,16,16,16,16};定义显示缓冲
unsigned char timecount;定义变量(计数单元)
unsigned char readdata[8]; 定义变量
sbit DQ=P3^7;定义连接ds18b20端口
bit sflag;定义标致位
.
.
无符号变量和有符号变量的区别What`s the difference between the unsigned int
无符号变量和有符号变量的区别
What`s the difference between the unsigned integer and the signed integer?(in c++)
樱景严1年前1
zhouminxia 共回答了25个问题 | 采纳率92%
In C/C++ and some other language (e.g. Java), integers r stored in the memory using 2's complement notation.
For positive integers, their 2's complement notation is of no difference from their binary representation.
Negative integers r slightly more complicated. To achieve their 2's complement notation, u can:
1. get the binary representation of its absolute value;
2. add 1 to that representation.
Of course, there're restrictions of limited memory space.
In this way, negative integers r stored in the memory in quite a same way as positive ones.
e.g. 1111 1111 = -1;
However, for a unsigned integer, it is assumed that no negative integers r stored, i.e. all the numbers r stored using their binary representation. In this case, 1111 1111 = 255.
完全原创,看不懂的话补充说明或者叫我翻译.
★关于素数筛选法编写一函数unsigned int *findPrime(unsigned int n),按照Eract
★关于素数筛选法
编写一函数unsigned int *findPrime(unsigned int n),按照Eractosthenes筛法找出1-n之间的素数.然后在编写一函数void printPrime(unsigned int *p,int n)打印这些素数.(提示:在findPrime函数分配堆内存表示筛法中用到的数组,并返回该数组首地址),主函数可为:
void main()
{
unsigned int *sieve;
unsigned int n;
printf("enter a number:");
scanf("%u",&n);
sieve = findPrime(n);
printPrime(sieve,n);
free(sieve);
}
枇杷老鼠1年前1
sdyswm2008 共回答了16个问题 | 采纳率93.8%
楼上好像不是Eractosthenes筛法吧
#include
#include
#include
unsigned int *findPrime(unsigned int n)
{
int i,j,k;
unsigned int *a=(unsigned int*)malloc(n*sizeof(unsigned int));
for(i=2;i
请编写一个unsigned fun(unsigned w)
请编写一个unsigned fun(unsigned w)
请编写一个unsigned fun(unsigned w),w是一个大于10的无符号整数,若w是n(n>=2)位的整数,函数求出w的后n-1位的数作为函数值返回。
例如:w值为5923,则函数返回923;w值为923则函数返回23。
3dlp1年前1
猜吧 共回答了16个问题 | 采纳率100%
#include
unsigned fun(unsigned w)
{
int c = 0, t = w, i;
while (t)
{
++c;
t /= 10;
}
if (c > 1)
{
t = 1;
for (i = 0; i < c-1; ++i)
t *= 10;

return (w % t);
}

return 0;
}
void main(void)
{
printf("%d %dn", fun(1234), fun(5678));
}
补码运算的问题unsigned short a;short int b = -1;a = b;-1的补码形式为11111
补码运算的问题
unsigned short a;
short int b = -1;
a = b;
-1的补码形式为1111111111111111(即全部16个二进制位均为1),将它传送给a,而a是无符号型变量,16个位全1是十进制的65535。如果b为正值,且在0~32767之间,则赋值后数值不变.
a第一位不是符号位么.?为什么16个位全是1,最后一位不算服符号位?
hdy11091年前1
66个realtree 共回答了11个问题 | 采纳率90.9%
你得强制定义a。服从b。你把a定义为unsign的,unsign是无符号位的,那么第一位就不是符号位。最后不是符号位。
unsigned char discode[] ={0X03,0X9F,0X25,0X0D,0X99,0X41,0X1F
unsigned char discode[] ={0X03,0X9F,0X25,0X0D,0X99,0X41,0X1F,0X01,0X09};
x05x05x05unsigned char const positon[3]={ 0xdf,0xbf,0x7f};
x05x05x05unsigned char disbuff[4]x05 ={ 0,0,0,};
//
void Display(void)x05x05x05x05 //扫描数码管
x05{
x05 if(posit==0) //就是这句话
x05 {P0=(discode[disbuff[posit]])&0x7f;} //就是这句话
x05 elsex05x05x05x05x05x05x05x05 //就是这句话
x05 {P0=discode[disbuff[posit]];}x05x05 //就是这句话
P2=positon[posit];
x05 if(++posit>=3)
x05 posit=0;
x05}
啊迁1年前1
wtlb1 共回答了16个问题 | 采纳率81.3%
unsigned chardiscode[] ={0X03,0X9F,0X25,0X0D,0X99,0X41,0X1F,0X01,0X09};
unsigned char const positon[3]={ 0xdf,0xbf,0x7f};
unsigned char disbuff[4]={ 0,0,0,};
//
void Display(void)x09x09x09x09 //扫描数码管
{
if(posit==0)//如果是第一个位置,那么显示小数点
{
P0=(discode[disbuff[posit]]) 0x7f; //这里是清除BIT7位的意思
}
elsex09//不是第一个位置,就不显示小数点了x09x09x09x09{
P0=discode[disbuff[posit]];// 赋段码的值
}x09x09
P2=positon[posit];// 给P2端口赋位码值
if(++posit>=3)// 动态扫描,位置的值在0~3之间循环
posit=0;
}
感激 若能答好追加100分#include #include /*函数Dto2(unsigned n)的功能是将无符号的
感激 若能答好追加100分
#include
#include
/*函数Dto2(unsigned n)的功能是将无符号的10进制数n转换成二进制数并输出,要求使用栈结构,
请将函数补充完整,并调试运行*/
void Dto2(unsigned n)
{int stack[100];
int top=-1;
/*请在此处将本函数补充完整*/
while(n>0)
{stack[++top]=n%2;
n=n/2;
}
while(top>-1)
printf("%d",stack[top--]);
}
void main()
{unsigned n=0xA0B0;
printf("n=%xn",n);
printf("n=");
Dto2(n);
getch();
}
奇怪了n不是十六进制数吗?这个Dto2是将十进制转化成二进制
这个怎么能行呢
怎么不用将十六进制先转化成十进制在用Dto2函数呢?
放心虽然现在我只有56分,但会天天登录
一定会弄到100分来答谢的
不能理解,可否说详细些 unsigned是定义无符号的,难道无符号的就一定是十进制吗,unsigned n=0xA0B0;
printf("n=%xn",n); n还不是十六进制的吗
怎么没人理,那就先给50分,满意在加50
侧马笑西风1年前1
坏得不简单 共回答了20个问题 | 采纳率85%
unsigned n
这里定义的n是无符号数,并不是十六进制呀~,应该n是十进制的,这样就没有问题了.
C语言问题 不正确的变量说明是不正确的变量说明是( ). A. unsigned int ui; B. short in
C语言问题 不正确的变量说明是
不正确的变量说明是( ).

A. unsigned int ui;

B. short int s;
C. double int A;
D. int i,j,k;
月影清扬1年前1
天空失了色 共回答了13个问题 | 采纳率84.6%
C. double int A;
double是浮点型,int是整形,不可以一起
求助tmp1[0]=tmp1[1]=tmp1[2]=tmp1[3]=*(have i);Unsignedshortdes
求助tmp1[0]=tmp1[1]=tmp1[2]=tmp1[3]=*(have i);Unsignedshortdestinati
beginunsignedcharmin;
141650白桦1年前1
ltzaltt 共回答了19个问题 | 采纳率94.7%
eginif(*(have i)>min)仿照unsignedcharmin;Unsignedshortdestinati
关于一道程序填空题的疑惑#include #include #include unsigned long fun(cha
关于一道程序填空题的疑惑
#include
#include
#include
unsigned long fun(char *s)
{
unsigned long t = 0;
int k;
int i = 0;
i = strlen(s);
for (--i; i>=0; i--)
{
k = s[i]-'0';
t = t*10+k;
}
return t;
}
main()
{
char str[8];
printf("Enter a string made up of '0' to '9' digital character :n");
gets(str);
printf("The string is :%sn",str);
if (strlen(str) > 8)
printf(" The string is too long ");
else
printf("The result :%lun",fun(str));
}
fun函数中的for循环里,为什么k=s[i]-'0'还有为什么t=k+10*t?
感激不尽
lbgss1年前1
y-y-ll 共回答了20个问题 | 采纳率95%
首先,输入的是字符!也就是8位以内的数字是字符,后面的输出的是%lu(无符号长整型),类型不同,明显不能直接转换!
函数fun(str)的作用就是将字符串的8位数,转换成无符号的长整型!
转换的方式是把字符串中的每一位上的数字取出来,然后加起来(数字ab=十位数a*10+个位数b,如56=5*10+6),这个算法自己理解!
至于k=s[i]-'0'就是把对应的字符型数字s[i],转换成整形的s[i],字符型在强制转换成整形的时候,值等于字符型对应的ascii码值,同时,0-9的ascii码值是连续的,所以字符s[i]对应的数字值,等于字符s[i]对应的ascii码值减去0对应的ascii码值!
在Vhdl中,定义count是unsigned(3downto0),怎么理解count=count+1这个表达式,其中1
在Vhdl中,定义count是unsigned(3downto0),怎么理解count=count+1这个表达式,其中1怎么理解,
还有其中1为什么不能写成'1'?
warmicee1年前1
yulianghappy201 共回答了17个问题 | 采纳率88.2%
这里count相当于用二进制表示十六进制数,而且是无符号数,count+1的意思是在给定初值的情况下,对初值加一,一般用于计数器中
而你说的为什么不能是'1',必须的呀,'1'是字符,1是数字,count本身不是字符型的,两者不能加
请帮忙分析一下句子成分及主干,A 32-bit unsigned fixed-point number (16.16)
请帮忙分析一下句子成分及主干,
A 32-bit unsigned fixed-point number (16.16) that indicates the rate at which the sound samples were obtained.
最好有翻译,
华府家丁95271年前2
qlyyyxq 共回答了18个问题 | 采纳率94.4%
A 32-bit unsigned fixed-point number (16.16)这是主语,that引导主语从句解释说明这个number表明了一个速度,速度(rate)后接定语从句,主语后应该是were obtained.
C语言位运算问题下列程序的运行结果是_______.  main()  { unsigned c1=0xff,c2=0x
C语言位运算问题
下列程序的运行结果是_______.
  main()
  { unsigned c1=0xff,c2=0x00;
  c1=c2|c1>>2;c2=c1^0236;
  printf(“%x,%xn”,c1,c2);
  }
 A)0x3f,0XA1 B)3f,A1 C)ffff,61 D)3f,a1
求高人解释一下这个问题,我算的答案都不对,答案应该是选D
家乡的鱼1年前1
p_ojgfd3wa_6d60 共回答了17个问题 | 采纳率82.4%
是选D
首先要知道c1的二进制是11111111,c2是0
c1右移两位就是00111111,与c2位或就得0011111111,所以c1值变为3f
然后c1是00111111,026为10011110,取位异或得10100001,所以c2值变为a1
c++指针强制类型转换 unsigned int a = 0xFFFFFFF7; char*b = (char*)&a;
c++指针强制类型转换 unsigned int a = 0xFFFFFFF7; char*b = (char*)&a; printf("%08x",*b);输出的问题
unsigned int a = 0xFFFFFFF7;
char*b = (char*)&a;
printf("%08x",*b);
这段代码输出为FFFFFFF7,可以理解为*b输出了a存储区的数据,可是将char*换成unsigned char*之后,输出为000000F7,只输出了低字节,一个字节的内容,这是为什么?
路飞超人1年前1
pangshaoyan 共回答了20个问题 | 采纳率80%
问题多了去了,char*能输出正确hi运气好
首先int,4字节,他在内存中是反着存的,就是说内存中的a其实是F7 FF FF FF
你定义的char*b,其实b指向的就是F7,由于 定义的是有符号的,所以前面多了6个F,无符号就能正确.
还有就是printf("%08x", *b);这东西是无法输出4字节的,
printf("%02x", *b);
printf("%02x", *(b+1));用这样来输出
英语翻译voidGPIO_PORT_D_ISR(void){unsigned char ucKey;unsigned l
英语翻译
void
GPIO_PORT_D_ISR(void)
{
unsigned char ucKey;
unsigned long ulStatus;
ulStatus = GPIOPinIntStatus(GPIO_PORTD_BASE,true);
GPIOPinIntClear(GPIO_PORTD_BASE,ulStatus);
if(ulStatus & GPIO_PIN_7)
{
ucKey = GPIOPinRead(GPIO_PORTC_BASE,GPIO_PIN_4);
ucKey = ucKey>>1;
ucValue = ucValue + ucKey;
//ucValue = ucValue
毛乾业1年前1
如此多礁 共回答了25个问题 | 采纳率88%
哦,这些是编程序代码啊,具体的还不是很清楚,你拿出课本再复习下,关键还是那些字母很多,当成数字或者易于理解的代进去.这个应该是你的课程题目或者你要考试的题目吗,你就对应课本里面的知识点.参考下,因为本人不是专业学习这块,所以不怎么懂啊.望见谅.
USE IEEE.STD_LOGIC_UNSIGNED.ALL; 报错
USE IEEE.STD_LOGIC_UNSIGNED.ALL; 报错
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY CNT10 IS
PORT (CLK,RST,EN,LOAD:IN STD_LOGIC;
DATA:IN STD_LOGIC_VECTOR(3 DOWNTO 0);
DOUT:OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
COUT:OUT STD_LOGIC);
END CNT10;
ARCHITECTURE behav OF CNT10 IS
BEGIN
PROCESS(CLK,RST,EN,LOAD)
VARIABLE Q:STD_LOGIC_VECTOR(3 DOWNTO 0);
BEGIN
IF RST='0' THEN Q:=(OTHERS=>'0');
ELSIF CLK' EVENT AND CLK='1' THEN
IF EN='1' THEN
IF (LOAD='0') THEN Q:=DATA;ELSE
IF Q'0');
ENDIF;
ENDIF;
ENDIF;
ENDIF;
IF Q="1001" THEN COUT
萧焰1年前1
dtrtgrt 共回答了14个问题 | 采纳率92.9%
第二行少了个分号,后面连续的四个end if中间是有空格的~
一个简单的C++问题,64-bit unsigned integer是什么意思,在C++中用什么表示?原C++题如下:D
一个简单的C++问题,
64-bit unsigned integer是什么意思,在C++中用什么表示?
原C++题如下:
Description
This is a classical problem.Your job is to calculate the combination formula ,
C(n,m) = / (m!(n - m)!)
since n,m and C(n,m) fit a 64-bit unsigned integer.
Input
The first line of input there is one integer T (T
zhangjg991年前1
晓望 共回答了13个问题 | 采纳率92.3%
64-bit unsigned integer是指64位无符号数
#include
#include
using namespace std;
unsigned long long jiechen(unsigned long long n,unsigned long long m=1){
unsigned long long i,results=1;
for (i=n;i>m;i--) results *= i;
return results;
}
int main(){
unsigned long long sum;
int cnum,i;
unsigned long long *m,*n;
cout
这个程序不懂,#include #define uchar unsigned char#define uint unsi
这个程序不懂,
#include
#define uchar unsigned char
#define uint unsigned int
sbit BEEP = P3^7;
uchar code DSY_CODE[]=
{
0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0x00
};
uchar Pre_KeyNO = 16,KeyNO = 16;(这个不懂)
void DelayMS(uint ms)
{
uchar t;
while(ms--)
{
for(t=0;t> 4 ^ 0x0f;(这个不懂)
switch(Tmp)
{
case 1:KeyNO += 0; break;(为什么有+)
case 2:KeyNO += 4; break;
case 4:KeyNO += 8; break;
case 8:KeyNO += 12;
}
}
void Beep()
{
uchar i;
for(i=0;i
EricDale1年前1
hgc0912 共回答了20个问题 | 采纳率95%
脱离了硬件不太好理解,不过大体应该是
0.0问题:还有P1口,P0口分别代表什么啊!
这是最基本的,可能那你不是搞硬件的,那是单片机的IO口
1uchar Pre_KeyNO = 16,KeyNO = 16;(这个不懂)
这两个应该是来实现一个消抖的功能
2Tmp = P1 ^ 0x0f;(是检测地位有没有1吗)
逻辑与取低四位
3case 1:KeyNO += 0; break;(为什么有+)
和后面的一起表示那个按下的意思,不能单独理解
4P0 = 0x00;(这个不懂)
置零,和内部有关
5if(Pre_KeyNO != KeyNO)(不懂
消抖
6P0 = DSY_CODE[KeyNO];(不懂
表示有按键按下
7P0 = DSY_CODE[KeyNO];(不懂)
表示有按键按下
8Pre_KeyNO = KeyNO;(Pre_KeyNO,KeyNO分别是什么意思啊)
消抖的辅助工具
9 ok
C遗传算法struct individual{unsigned char *chrom;double fitness;d
C遗传算法
struct individual
{
unsigned char *chrom;
double fitness;
double varible;
int xsite;
int parent[2];
int *utility;
};
struct individual *oldpop;
struct individual *newpop;
void initmalloc()
{
unsigned char nbytes;
int j;
nbytes=popsize*sizeof(struct individual);
if((oldpop=(struct individual*)malloc(nbytes))==NULL)
nomemory("oldpop");
if((newpop=(struct individual*)malloc(nbytes))==NULL)
nomemory("newpop");
nbytes=chromsize*sizeof(unsigned char);
for(j=0;j
plmn51年前1
喷喷龙 共回答了17个问题 | 采纳率94.1%
一个非常简单的遗传算法源代码,是由Denis Cormier (North Carolina State University)开发的,Sita S.Raghavan (University of North Carolina at Charlotte)修正.代码保证尽可能少,实际上也不必查错.对一特定的应用修正此代码,用户只需改变常数的定义并且定义“评价函数”即可.注意代码的设计是求最大值,其中的目标函数只能取正值;且函数值和个体的适应值之间没有区别.该系统使用比率选择、精华模型、单点杂交和均匀变异.如果用Gaussian变异替换均匀变异,可能得到更好的效果.代码没有任何图形,甚至也没有屏幕输出,主要是保证在平台之间的高可移植性.读者可以从ftp.uncc.edu,目录 coe/evol中的文件prog.c中获得.要求输入的文件应该命名为‘gadata.txt’;系统产生的输出文件为‘galog.txt’.输入的文件由几行组成:数目对应于变量数.且每一行提供次序——对应于变量的上下界.如第一行为第一个变量提供上下界,第二行为第二个变量提供上下界,等等.
//
.
代码太多 你到下面呢个网站看看吧
void main(void)
{
int i;
if ((galog = fopen("galog.txt","w"))==NULL)
{
exit(1);
}
generation = 0;
fprintf(galog,"n generation best average standard n");
fprintf(galog," number value fitness deviation n");
initialize();
evaluate();
keep_the_best();
while(generation{
generation++;
select();
crossover();
mutate();
report();
evaluate();
elitist();
}
fprintf(galog,"nn Simulation completedn");
fprintf(galog,"n Best member:n");
for (i = 0; i < NVARS; i++)
{
fprintf (galog,"n var(%d) = %3.3f",i,population[POPSIZE].gene[i]);
}
fprintf(galog,"nn Best fitness = %3.3f",population[POPSIZE].fitness);
fclose(galog);
printf("Successn");
}
另外,虚机团上产品团购,超级便宜
编写具有如下原型的函数:int f(unsigned long x,int n,int& Lxn);
编写具有如下原型的函数:int f(unsigned long x,int n,int& Lxn);
它负责将整数x的第n位(从左边数第n位,n>0)的数值放到引用Lxn之中(将作为结果返回到主调函数的对应实参变量中),并将倒数第n位(从右边数第n位,n>0)的数值作为函数结果返回去.并编制主函数对它进行调用以验证其正确性.
例如,当x=123456789,n=7时,执行语句“Rxn=f(x,n,Lxn);”将使返回的Lxn为7,并使Rxn变为3;而执行语句“Rxn=f(12345,6,Lxn);”将使Lxn与Rxn都变为为0(超出数的“长度”即总位数时返回0)
故事完结1年前1
takewing 共回答了16个问题 | 采纳率93.8%
只给核心算法:
提取自右向左数的第n位用表达式:
x / pow(10, n - 1) % 10
也就是x除以10的n-1次方,再取对10的余数.如
18872387的第4位是2,就是
18872387 / pow(10, 4 - 1) % 10
= 18872387 / 1000 % 10
= 18872 % 10
= 2