有关itoa将整型转换成字符型的使用
来源:互联网 发布:智慧城市业务数据库 编辑:程序博客网 时间:2024/05/17 02:33
// itoa.cpp : 定义控制台应用程序的入口点。
/*--------------------------------------------*/
/*--------coding by wyz 2017/8/10-------------*/
/*--------------------------------------------*/
#include "stdafx.h"
#include <stdlib.h>
#include <iostream>
#include<string>
//#include <stdio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int num=123456;
char aa[20];
// itoa(num,aa,10);
for (int i=0;i<20;i++){
itoa(i,aa,10);//10 表示是10进制数
}
cout<<"aa="<<aa<<endl;
for(int i=0;i<20;i++){
cout<<aa[i]<<endl;
}
string sa;
sa='B';
cout<<"sa="<<sa<<endl;
sa+='A';
cout<<"sa+A="<<sa<<endl;
//cout<<"aa[1]="<<aa[1]<<endl;
//char bb[]={'A','B','C','D','E','F'};
// bb[0]=bb[1]+bb[0];
// cout<<"bb[0]="<<bb[0]<<endl;
//cout<<"bb[1]"<<endl;
//<<*bb<<endl;
//atoi(bb);
//cout<<bb<<endl;;
system("pause");
return 0;
}
/*--------------------------------------------*/
/*--------coding by wyz 2017/8/10-------------*/
/*--------------------------------------------*/
#include "stdafx.h"
#include <stdlib.h>
#include <iostream>
#include<string>
//#include <stdio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int num=123456;
char aa[20];
// itoa(num,aa,10);
for (int i=0;i<20;i++){
itoa(i,aa,10);//10 表示是10进制数
}
cout<<"aa="<<aa<<endl;
for(int i=0;i<20;i++){
cout<<aa[i]<<endl;
}
string sa;
sa='B';
cout<<"sa="<<sa<<endl;
sa+='A';
cout<<"sa+A="<<sa<<endl;
//cout<<"aa[1]="<<aa[1]<<endl;
//char bb[]={'A','B','C','D','E','F'};
// bb[0]=bb[1]+bb[0];
// cout<<"bb[0]="<<bb[0]<<endl;
//cout<<"bb[1]"<<endl;
//<<*bb<<endl;
//atoi(bb);
//cout<<bb<<endl;;
system("pause");
return 0;
}
阅读全文
0 0
- 有关itoa将整型转换成字符型的使用
- 将字符转换成整型的办法
- 将char字符转换成int整型,字符串与整型之间的相互转换
- 将字符型转换为整型
- atoi(将字符串转换成整型数)和itoa(把一整数转换为字符串)
- atoi(将字符串转换成整型数)和itoa(把一整数转换为字符串)
- 整型转换成字符型
- 不使用itoa或sprintf等系统函数完成整型向字符串的转换
- 整型与字符型的相互转换
- 字符型至整型的转换[toascii]
- 整型与字符型之间的转换
- 库函数atoi的C语言实现---------将字符串的数字符转换成整型的数字
- 简明扼要的递归函数(将一个整型数转换成字符[串])
- 将字符数字转换为整型数字
- itoa(整型转字符型)与atoi(字符转整型)
- Linux下整型转换成字符串函数——itoa
- 整型 字符型转换c++
- 整型与字符型转换
- Git 使用
- 真农区块链技术的到来将会改变人们的生活方式!-全球区块链
- Post Office POJ
- 欢迎使用CSDN-markdown编辑器
- ES5基础
- 有关itoa将整型转换成字符型的使用
- BZOJ3670 [Noi2014]动物园 解题报告【字符串】【KMP】
- LintCode解题记录17.8.9 字符串处理5
- Delphi获得与设置系统时间格式《转》
- Android视频直播的实现(推流完整实现001)
- 线程与进程1
- 关于带有缓存的Spring的pom.xml文件
- 单例模式-恶汉-懒汉
- laravel笔记-请求与响应