C语言提供了几个标准库函数,能够将随意类型(整型.长整型.浮点型等)的数字转换为字符串.下面是用itoa()函数将整数转 换为字符串的一个样例: # include <stdio.h> # include <stdlib.h> void main (void) { int num = 100; char str[25]; itoa(num, str, 10); printf("The number ’num’ is %d and the
import java.io.*; public class Test{ /** * 二进制与整型之间的转换 * @param args * @throws IOException */ public static void main(String args[])throws IOException{ //整型转二进制 int a = -1; int b = 1; System.out.println(Integer.toBinaryString(a)); System.out.println(