当前位置:网站首页>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;
边栏推荐
- SAP ABAP BDC (batch data communication) -018
- 毕业之后才知道的——知网查重原理以及降重举例
- PTA ladder game exercise set l2-002 linked list de duplication
- OpenSergo 即将发布 v1alpha1,丰富全链路异构架构的服务治理能力
- Say sqlyog deceived me!
- 原生小程序 之 input切换 text与password类型
- 微信小程序蓝牙连接硬件设备并进行通讯,小程序蓝牙因距离异常断开自动重连,js实现crc校验位
- Why does the data center need a set of infrastructure visual management system
- SQL Server 2008 各种DateTime的取值范围
- 成为资深IC设计工程师的十个阶段,现在的你在哪个阶段 ?
猜你喜欢

Understand the deserialization principle of fastjson for generics

TCC of distributed transaction solutions

Web authentication API compatible version information

Interview skills of software testing

数据中心为什么需要一套基础设施可视化管理系统
![[cloud native] what is the microservice architecture?](/img/84/a0ec68646083f3539aa39ad9d98749.png)
[cloud native] what is the microservice architecture?

PTA 天梯赛练习题集 L2-004 搜索树判断

ML之shap:基于adult人口普查收入二分类预测数据集(预测年收入是否超过50k)利用shap决策图结合LightGBM模型实现异常值检测案例之详细攻略

Red hat install kernel header file

Five core elements of architecture design
随机推荐
Introduction to the extension implementation of SAP Spartacus checkout process
[InstallShield] Introduction
驱动开发中platform设备驱动架构详解
产业金融3.0:“疏通血管”的金融科技
Harmonyos practice - Introduction to development, analysis of atomized services
2pc of distributed transaction solution
Personal imitation SSM framework
STM32按键状态机2——状态简化与增加长按功能
Nodejs get client IP
PTA ladder game exercise set l2-002 linked list de duplication
Understand the deserialization principle of fastjson for generics
Introduction to distributed transactions
谈fpga和asic的区别
Web authentication API compatible version information
【日常训练--腾讯精选50】235. 二叉搜索树的最近公共祖先
C. colonne Swapping [tri + Simulation]
[daily training -- Tencent selected 50] 235 Nearest common ancestor of binary search tree
Pytorch builds neural network to predict temperature
Modes of optical fiber - single mode and multimode
Go language learning notes - Gorm use - Gorm processing errors | web framework gin (10)