转变 [英] conversion

查看:76
本文介绍了转变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c ++中将字符串转换为整数,反之亦然


Suhaas

how to convert a string to integer in c++ and vice versa

Suhaas

推荐答案


如何在c ++中将字符串转换为整数,反之亦然
how to convert a string to integer in c++ and vice versa



如果你的字符串在char []中你可以使用strstream类,例如

if your strings are in char[] you can use the strstream class, e.g.

展开 | 选择 | Wrap | 行号


如果你使用字符串使用sstream,例如
if you are using strings use sstream, e.g.
展开 | 选择 | Wrap | 行号


我可以使用atoi()函数进行转换字符串为整数和sprintf()为反之?

can i use the atoi() function for converting from string to integer and sprintf() for viceversa?


如果你使用字符串使用sstream,例如
if you are using strings use sstream, e.g.
展开 < span class =codeDivider> | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


这篇关于转变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆