c语言进制转换方法
今天发现了进制转换方法,再此进行记录
itoa方法
最新vs上使用itoa方法的格式为: _itoa(value,string/char[],radix)
- value:要转换的数据
- string:目标字符串或字符数组
- radix:转换后的进制数,范围必须在2~36之间
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main() {
int a;
char b[100];
while (scanf("%d", &a) != EOF) {
_itoa(a, b, 2);
printf("%s\n", b);
}
return 0;
}

浙公网安备 33010602011771号