牛客790167564号
牛客790167564号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客790167564号的博客
全部文章
(共48篇)
题解 | #子类中调用父类构造#
直接写参数列表里就好啦 #include <iostream> using namespace std; class Base { private: int x; int y; public: Base(int x, int y) { ...
2024-08-04
1
102
题解 | #浅拷贝和深拷贝#
拷贝构造函数完全可以照着构造函数写 #include <iostream> #include <cstring> #pragma warning(disable : 4996) using namespace std; class Person { public: ...
2024-08-03
0
128
题解 | #构造函数#
参数列表挺好用的~ #include <iostream> #include <string> using namespace std; // Person类 class Person { public: string name; // 姓名 i...
2024-08-03
0
109
题解 | #点和圆的关系#
判断点和圆的关系的方法:比较点到圆心的距离,若距离小于半径就在圆内,若距离等于半径就在圆上,若大于就在圆外。这里Pointer类里本来是 没有distance函数的! 千万不要直接拿来用哦!我定义它是为了更好确定点到圆心的距离(圆心也是点嘛),这里定义实现分离比较好看,但是它题目模板里都是放在类里的...
2024-08-03
0
110
题解 | #设计立方体类#
类的设计很简单,而且函数只是获取类中某一成员或表面积体积,我这种是把定义和实现分开写(一大堆函数啊。。。) #include <iostream> using namespace std; class Cube { public: void setLength(int l)...
2024-08-03
0
124
题解 | #简写单词#
这题是要提取出每个单词的首字母,只需要看一个字母的前面一个字符是不是空格或者这个字母是第一个字母就行了,注意要大写 #include <iostream> #include <string> using namespace std; int main() { str...
2024-08-01
0
100
题解 | #三角形判断#
没什么好说的,只要注意要是个三角形才能继续判断等腰和等边,比如1 1 2这种,要是先判断等边和等腰会把它识别成等腰 #include <iostream> using namespace std; int main() { int a, b, c; while (cin...
2024-08-01
0
101
题解 | #计算单位阶跃函数#
过于low了,真的只用跟0比较再输出就好了 #include <iostream> using namespace std; int main() { int a; while(cin>>a) if(a>0)cout<<1&...
2024-08-01
0
91
题解 | #牛牛的一周#
其实只需要用switch就行,但我为了省事就把break缩成了bk,把cout<<缩成了out(用define做的) #include <iostream> using namespace std; #define bk break #define out cout<&...
2024-08-01
0
97
题解 | #牛牛的金币#
简单判断一下就好啦 #include <iostream> using namespace std; int main() { int x,y,x1,y1; cin>>x>>y>>x1>>y1; if(x==x1)...
2024-08-01
0
103
首页
上一页
1
2
3
4
5
下一页
末页