当前位置:网站首页>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;
边栏推荐
- 一名普通学生的大一总结【不知我等是愚是狂,唯知一路向前奔驰】
- yarn入门(一篇就够了)
- 上海字节面试问题及薪资福利
- C. colonne Swapping [tri + Simulation]
- 980. Different path III DFS
- How to improve website weight
- Storage of dental stem cells (to be continued)
- 2pc of distributed transaction solution
- STM32 key state machine 2 - state simplification and long press function addition
- 数据中心为什么需要一套基础设施可视化管理系统
猜你喜欢
![[云原生]微服务架构是什么?](/img/84/a0ec68646083f3539aa39ad9d98749.png)
[云原生]微服务架构是什么?
![C. colonne Swapping [tri + Simulation]](/img/0e/64d17980d3ec0051cdfb5fdb34e119.png)
C. colonne Swapping [tri + Simulation]

Randomly generate session_ id

软件测试面试技巧
![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

Realize GDB remote debugging function between different network segments

mac版php装xdebug环境(m1版)

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

An example of multi module collaboration based on NCF

JVM the truth you need to know
随机推荐
驱动开发中platform设备驱动架构详解
Realize GDB remote debugging function between different network segments
Reading notes of Clickhouse principle analysis and Application Practice (6)
Industrial Finance 3.0: financial technology of "dredging blood vessels"
Introduction to distributed transactions
win配置pm2开机自启node项目
EMMC打印cqhci: timeout for tag 10提示分析与解决
Go 語言的 Context 詳解
盘点国内有哪些EDA公司?
CMD permanently delete specified folders and files
Add salt and pepper noise or Gaussian noise to the picture
Input of native applet switches between text and password types
Differences and introduction of cluster, distributed and microservice
[daily training -- Tencent selected 50] 235 Nearest common ancestor of binary search tree
On the difference between FPGA and ASIC
JVM命令之 jinfo:实时查看和修改JVM配置参数
得物客服一站式工作台卡顿优化之路
【SQL实战】一条SQL统计全国各地疫情分布情况
Get the way to optimize the one-stop worktable of customer service
Red hat install kernel header file