Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert string and int in C++

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to convert string and int in C++". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to convert string and int in C++".

1. Int to string

# include # include int main () {double f = 23.43; double f2 = 1emur9; double f3 = 1e40; double f4 = 1emur40; double f5 = 123456789; std::string f_str = std::to_string (f); std::string f_str2 = std::to_string (f2); / / Note: return "0.000000" std::string f_str3 = std::to_string (f3) / / Note: do not return "1e+40". Std::string f_str4 = std::to_string (f4); / / Note: return "0.000000" std::string f_str5 = std::to_string (f5); std::cout

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report