当前位置:网站首页>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;
边栏推荐
- 老板总问我进展,是不信任我吗?(你觉得呢)
- [cloud native] what is the microservice architecture?
- Web authentication API compatible version information
- 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
- zabbix_get测试数据库失败
- Classic questions about data storage
- 微信小程序蓝牙连接硬件设备并进行通讯,小程序蓝牙因距离异常断开自动重连,js实现crc校验位
- 数据中心为什么需要一套基础设施可视化管理系统
- 原生小程序 之 input切换 text与password类型
- CTFshow--常用姿势
猜你喜欢
每秒10W次分词搜索,产品经理又提了一个需求!!!(收藏)
VScode进行代码补全
一个简单的代数问题的求解
三级菜单数据实现,实现嵌套三级菜单数据
Go语学习笔记 - gorm使用 - 原生sql、命名参数、Rows、ToSQL | Web框架Gin(九)
Pytorch builds neural network to predict temperature
[InstallShield] Introduction
@pathvariable 和 @Requestparam的详细区别
Hcip eighth operation
Forkjoin is the most comprehensive and detailed explanation (from principle design to use diagram)
随机推荐
微信小程序蓝牙连接硬件设备并进行通讯,小程序蓝牙因距离异常断开自动重连,js实现crc校验位
Forkjoin is the most comprehensive and detailed explanation (from principle design to use diagram)
C. colonne Swapping [tri + Simulation]
Dynamic memory management
win配置pm2开机自启node项目
【已解决】记一次EasyExcel的报错【读取xls文件时全表读不报错,指定sheet名读取报错】
牙齿干细胞的存储问题(未完待续)
[shell] clean up nohup Out file
I didn't know it until I graduated -- the principle of HowNet duplication check and examples of weight reduction
CMD permanently delete specified folders and files
Explication contextuelle du langage Go
线性回归
Hcip eighth operation
关于STC单片机“假死”状态的判别
Add salt and pepper noise or Gaussian noise to the picture
原生小程序 之 input切換 text與password類型
力扣102题:二叉树的层序遍历
盘点国内有哪些EDA公司?
SAP ABAP BDC (batch data communication) -018
SQLSTATE[HY000][1130] Host ‘host. docker. internal‘ is not allowed to connect to this MySQL server