天天看点

C++整数转字符串

两种结果都输出字符串233

_itoa第三个参数代表进制

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>


int main(void)
{
	int a=233;
	char c[10] ;
	char d[10];
	_itoa(a,c,10);
	sprintf(d, "%d", a);

	printf("%s \n", c);
	printf("%s \n", d);

	system("pause");
	return 0;
}
           
下一篇: C++ enum用法

继续阅读