整数与字符串转换
来源:互联网 发布:手机剪切视频的软件 编辑:程序博客网 时间:2024/05/21 12:06
#include <iostream>#include <vector>using namespace std;#define MaxNum 20int main(){//下面是整数转为字符串;int data;cout<<"please input your int data"<<endl;cin>>data;if(!cin) return 1;int i=0,j=0,temp; char str[MaxNum],str1[MaxNum];while(temp=data%10){str[i]=temp+'0';data/=10;i++;}j=--i;i=0;while(j>=0){str1[i]=str[j];i++;j--;}str1[i]='\0';cout<<str1<<endl;//下面是字符串转为整数cout<<"please input your string"<<endl;cin>>str;if(!cin) return 0;i=0,temp=0;while(str[i]!=NULL){temp=temp*10+(str[i]-'0');i++;}cout<<temp<<endl;}
0 0
- 整数与字符串转换
- 字符串与整数互相转换
- Java整数与字符串转换
- 字符串与整数之间的转换
- Flex 中的字符串 与 整数转换
- 整数与字符串的相互转换
- 字符串与整数之间的转换
- 字符串与整数的相互转换
- JAVA整数与字符串之间的转换
- 整数与字符串的相互转换
- 整数与字符串的相互转换
- Java 字符串与整数的转换
- 字符串转换整数及整数转换字符串
- 字符串转换为整数(atoi)与整数转换成字符串(itoa)的实现
- 字符串转换为整数
- 整数转换成字符串
- 字符串转换为整数
- 整数字符串的转换
- openstack windows下远程debug调试(pycharm)
- 常用的事件晌应函数
- 简单记录,设置一体化状态栏背景颜色的方法
- 解决头文件相互包含问题的方法
- 幂次法则power law
- 整数与字符串转换
- LVM的创建与删除
- C++ Primer学习 《语句-Statements》
- Eclipse快捷键 10个最有用的快捷键
- leetcode->Candy
- 程序员生存定律--表达背后的力量(2)【转】
- 把datetime类型的日期转化成年月日或其他格式方法总结
- vim下如何删除空格行和删除行首空格和行尾空格<转>
- spring四种依赖注入方式