
C++
程序猿-牧童
这个作者很懒,什么都没留下…
展开
-
C++将string转为int
**C++将string转为int**方法一:使用stringstream(流的输入输出操作实现)#include <iostream>#include <sstream> //引用stringstream的头文件#include <string>using namespace std;int main(){ int x; str...原创 2019-05-06 19:17:48 · 16729 阅读 · 1 评论 -
C++ 输入字符串
C++ 输入字符串方法一:cin >> str;此方法在读取时,会自动忽略开头的空白,并从第一个真正的字符开始读起,直到遇见下一处空白为止。#include <iostream>#include <string>using namespace std;int main(){ string str; cin >> str; c...原创 2019-06-12 11:15:54 · 718 阅读 · 0 评论