标签:分享图片 实现 使用 编译环境 typedef 图片 include 技术 int
首先需要C++ 11的支持
打开devC++,点击tools,点击编译环境,然后出现的框第一个勾选,输入-std=c++11即可
然后使用 to_string() 和 atoi() 就可以轻松实现其相互转换
1 #include <iostream> 2 #include <algorithm> 3 #include <string> 4 #include <sstream> 5 typedef long long ll; 6 using namespace std; 7 int main() 8 { 9 // int -> string 10 int x = 3; 11 string s = to_string(x); 12 cout << s << endl; 13 14 // string -> int 15 string a = "124"; 16 int b = atoi(a.c_str()); 17 cout << b; 18 19 }
标签:分享图片 实现 使用 编译环境 typedef 图片 include 技术 int
原文地址:https://www.cnblogs.com/wzy-blogs/p/9194764.html