diff --git a/QUSTOJ/1715.c b/QUSTOJ/1715.c new file mode 100644 index 0000000..b879daa --- /dev/null +++ b/QUSTOJ/1715.c @@ -0,0 +1,37 @@ +#include +#include +#include +/// itoa implement +char* int2str(int num,char* buff,int bina) +{ + char k[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; + if(bina==10) + { + sprintf(buff,"%d",num); + return buff; + } + int cnt=0; + while(num>0) + { + buff[cnt]=k[num%bina]; + num=num/bina; + cnt++; + } + buff[cnt]=0; + for(int i=0;i