如何用C++将数字“1”转换成字符“1”

[复制链接]
查看11 | 回复5 | 2018-5-10 14:40:12 | 显示全部楼层 |阅读模式
在中的函数是itoa。功能:把一整数转换为字符串。char *itoa(int value, char *string, int radix);int value 被转换的整数,char *string 转换后储存的字符数组,int radix 转换进制数,如2,8,10,16 进制等头文件: itoa操作使用程序例:#include #include int main(){int number = 123456;char string[25];itoa(number, string,...
回复

使用道具 举报

千问 | 2018-5-10 14:40:12 | 显示全部楼层
#includeintmain(){
char str[100];
// 声明字符数组
char str1[100];
memset(str,0,100);// 初始化数组内容全部为0,
memset(str1,0,100); /&#...
回复

使用道具 举报

千问 | 2018-5-10 14:40:12 | 显示全部楼层
根据ASCII码来设计一个函数char f(int a){returna+48;}...
回复

使用道具 举报

千问 | 2018-5-10 14:40:12 | 显示全部楼层
int a=1;char c=1+'0';...
回复

使用道具 举报

千问 | 2018-5-10 14:40:12 | 显示全部楼层
char c;c = 1+48;...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行