当前位置:网站首页>Convert numbers to string strings (to_string()) convert strings to int sharp tools stoi();
Convert numbers to string strings (to_string()) convert strings to int sharp tools stoi();
2022-07-07 05:59:00 【Grow your own flowers 111】

C++ Medium to_string() The series of functions will Convert numeric values to strings form .
The header file :#include<string>
string s = to_string(n); // The integer n Convert to string String representation
to_string()The prototypes of all functions are as follows :string to_string (int val);
string to_string (long val);
string to_string (long long val);
string to_string (unsigned val);
string to_string (unsigned long val);
string to_string (unsigned long long val);
string to_string (float val);
string to_string (double val);
string to_string (long double val);
Example :
#include <iostream>
#include <string>
using namespace std;
int main() {
int a = 4876867;
string str= to_string(a);
cout << str;
return 0;
}
After operation :
character string str=4876867;
take String conversion to int Type sharp weapon stoi();
stoi();
#include <iostream>
#include <string>
using namespace std;
int main() {
string a="15135";
int n=stoi(a);
cout<<n;
}Output n=15135;
边栏推荐
- The 2022 China low / no code Market Research and model selection evaluation report was released
- 每秒10W次分词搜索,产品经理又提了一个需求!!!(收藏)
- 苹果cms V10模板/MXone Pro自适应影视电影网站模板
- 牙齿干细胞的存储问题(未完待续)
- How to improve website weight
- Sidecar mode
- On the difference between FPGA and ASIC
- AI face editor makes Lena smile
- 《ClickHouse原理解析与应用实践》读书笔记(6)
- EMMC print cqhci: timeout for tag 10 prompt analysis and solution
猜你喜欢

Interview skills of software testing

Industrial Finance 3.0: financial technology of "dredging blood vessels"

搞懂fastjson 对泛型的反序列化原理

The 2022 China low / no code Market Research and model selection evaluation report was released

Web architecture design process

一名普通学生的大一总结【不知我等是愚是狂,唯知一路向前奔驰】

Loss function and positive and negative sample allocation in target detection: retinanet and focal loss

如何提高网站权重

产业金融3.0:“疏通血管”的金融科技

An example of multi module collaboration based on NCF
随机推荐
Go language context explanation
How to improve website weight
980. 不同路径 III DFS
Message queuing: how to ensure that messages are not lost
【SQL实战】一条SQL统计全国各地疫情分布情况
980. Different path III DFS
关于服装ERP,你知道多少?
2pc of distributed transaction solution
【日常训练--腾讯精选50】235. 二叉搜索树的最近公共祖先
绕过open_basedir
[InstallShield] Introduction
Mac version PHP installed Xdebug environment (M1 version)
How to get free traffic in pinduoduo new store and what links need to be optimized in order to effectively improve the free traffic in the store
话说SQLyog欺骗了我!
Reading notes of Clickhouse principle analysis and Application Practice (6)
成为资深IC设计工程师的十个阶段,现在的你在哪个阶段 ?
MFC BMP sets the resolution of bitmap, DPI is 600 points, and gdiplus generates labels
C. colonne Swapping [tri + Simulation]
苹果cms V10模板/MXone Pro自适应影视电影网站模板
搞懂fastjson 对泛型的反序列化原理