当前位置:网站首页>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;
边栏推荐
- [daily training -- Tencent selected 50] 292 Nim games
- Hcip seventh operation
- 得物客服一站式工作台卡顿优化之路
- Bat instruction processing details
- [cloud native] what is the microservice architecture?
- 线性回归
- Flask1.1.4 Werkzeug1.0.1 源码分析:启动流程
- Web architecture design process
- Forkjoin is the most comprehensive and detailed explanation (from principle design to use diagram)
- PTA ladder game exercise set l2-004 search tree judgment
猜你喜欢

Mac version PHP installed Xdebug environment (M1 version)

Go language learning notes - Gorm use - Gorm processing errors | web framework gin (10)
![SQLSTATE[HY000][1130] Host ‘host. docker. internal‘ is not allowed to connect to this MySQL server](/img/05/1e4bdddce1e07f7edd2aeaa59139ab.jpg)
SQLSTATE[HY000][1130] Host ‘host. docker. internal‘ is not allowed to connect to this MySQL server

What are the common message queues?
![[云原生]微服务架构是什么?](/img/84/a0ec68646083f3539aa39ad9d98749.png)
[云原生]微服务架构是什么?

Question 102: sequence traversal of binary tree

【FPGA教程案例13】基于vivado核的CIC滤波器设计与实现

EMMC打印cqhci: timeout for tag 10提示分析与解决

404 not found service cannot be reached in SAP WebService test

The 2022 China low / no code Market Research and model selection evaluation report was released
随机推荐
【日常训练--腾讯精选50】235. 二叉搜索树的最近公共祖先
原生小程序 之 input切換 text與password類型
产业金融3.0:“疏通血管”的金融科技
[daily training -- Tencent selected 50] 235 Nearest common ancestor of binary search tree
win配置pm2开机自启node项目
Sidecar mode
Determine whether the file is a DICOM file
Value range of various datetimes in SQL Server 2008
[SQL practice] a SQL statistics of epidemic distribution across the country
Cf:c. column swapping [sort + simulate]
SAP Spartacus checkout 流程的扩展(extend)实现介绍
Introduction to the extension implementation of SAP Spartacus checkout process
软件测试面试技巧
PTA 天梯赛练习题集 L2-002 链表去重
Things about data storage 2
如果不知道这4种缓存模式,敢说懂缓存吗?
JVM命令之 jinfo:实时查看和修改JVM配置参数
The solution of a simple algebraic problem
404 not found service cannot be reached in SAP WebService test
nVisual网络可视化