![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
笔记
偷偷写代码
想学门手艺。
展开
-
2021-09-06
继承的构造函数调用 在下面代码中,我在之前用strss继承了strs,但是不知道的是,父类的构造函数先于子类,导致我无法实现功能。 #include<iostream> #include<string> using namespace std; class strs //字符串类 { public: string str; int np,nt; //分别记录PAT的数量,正常来说,原创 2021-09-06 19:01:24 · 58 阅读 · 0 评论 -
2021-09-03
记录学习(string转int的方法) void qiuhe(string n) { sum=0; int p=0; stringstream str; for(int i=0;i<n.size();i++) { str<<n[i]; str>>p; str.clear(); sum+=p; } } 这里头文件要包含sstream sum是我定义类里的int型 不止可以转换int还有float,double等 ...原创 2021-09-03 17:41:09 · 78 阅读 · 0 评论 -
2021-09-03
记录一下学习 c++string类型转换为int类型 1)int i=Integer.parselnt(str); 2)int i=Integer.valueOf(str).intValue();原创 2021-09-03 16:46:00 · 47 阅读 · 0 评论