我的学习记录46
来源:互联网 发布:大数据 adhoc 编辑:程序博客网 时间:2024/05/18 03:46
2017.11.25李锦浩【第46天】
今天继续学习了关于类的继承性,多继承和单继承的问题,我只是对此做了一个简单的了解。明天还要继续学习继承的问题。另外我今天还编写了一个类的程序,加强对类的运用与学习。
附:
#include<iostream>
#include<ctime>
using namespace std;
struct point
{
int x;
int y;
};
class line
{
public:
line();
~line(){}
void showlist();
friend void setpoint(line&l1,line&l2);
private:
int a;
int b;
};
void line::showlist()
{
cout << "y=" << a <<"x+" << b << endl;
}
void setpoint(line&l1,line&l2)
{
point p;
int x, y;
x = (l1.b - l2.b);
y = (l2.a - l1.b);
p.x = x / y;
p.y = l1.a*p.x + l1.b;
cout << "x=" << p.x << endl;
cout << "y=" << p.y << endl;
}
line::line()
{
int xa[20];
srand(time(0));
for (int i = 0; i < 20; i++)
{
xa[i] = rand() % 10;
}
srand(xa[20]);
a = rand() % 10;
b = rand() % 10;
}
int main()
{
line l1;
l1.showlist();
line l2;
l2.showlist();
setpoint(l1, l2);
system("pause");
return 0;
}
明天任务:明天学习关于类的继承性,编写一个重载符号的程序。
- 我的学习记录46
- 我的学习记录
- 我的学习记录
- 我的学习记录
- 记录生活,记录学习----我的2016
- 开始我的学习记录
- 记录我的学习过程
- 我的OGRE学习记录
- 我的oracle学习记录
- 我的PHP学习记录。
- 我的Linux学习记录
- 记录我的学习历程
- 记录我的Android学习
- 记录我的学习过程
- [cocos2dx]我的学习记录
- 记录我的学习过程
- 我的学习记录整理
- 我的Golang学习记录
- Python简化类例三:实现类实例的事件定义
- localStorage存储
- 牛客网wannafly 4,b题(小AA的数列
- JAVA 类声明中关键字public的作用
- 《基础网页制作》div加float实现一个简单的首页
- 我的学习记录46
- redis清空缓存
- Intelligence Math Part2
- 深入理解乐观锁与悲观锁
- matlab图像处理之RGB转Ycbcr or gray
- MyBatis学习笔记(二)--配置环境详解
- leetcode 136-Single Number
- C++中几种读取数据的函数的用法
- MPAndroidChart开源图表库的使用介绍之饼状图、折线图和柱状图