PX-33-进制输出
进制转换的函数 _itoa()
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> void main() { int num = 0; scanf("%d", &num); printf("num=%i", num); //%d,%i一样的效果 char str[32] = {0}; _itoa(num, str, 2); //字符串,第一个整数,str字符串,2 printf("\n%s", str); _itoa(num, str, 8); printf("\n%s", str); _itoa(num, str, 10); printf("\n%s", str); _itoa(num, str, 16); printf("\n%s", str); system("pause"); } // < 1.txt 用1.txt来输入 //>2.txt用2.txt输出

浙公网安备 33010602011771号