Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Тимофей Кузнецов, сегодня в 11:16
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- #include "point.h"
- class Curve{
- public:
- virtual Point f(int k) = 0;
- friend double length(const Point &t, const Point& t1);
- };
- Тимофей Кузнецов, сегодня в 11:15
- #include "stdafx.h"
- #include <iostream>
- #include "point.h"
- #include "Curve.h"
- #include "Polynome.h"
- #include <time.h>
- #include <math.h>
- Polynome::Polynome(const Point &p0, const Point &p1, const Point &p2){
- t = p0;
- t2 = p1;
- t3 = p2;
- }
- Point Polynome:: f(int k){
- Point c;
- c = t3*k*k + t2*k + t;
- return c;
- }
- Тимофей Кузнецов, сегодня в 11:15
- #include "stdafx.h"
- #include <iostream>
- #include "point.h"
- #include "Curve.h"
- #include <time.h>
- #include <math.h>
- class Polynome : public Curve{
- private: Point t;
- Point t2;
- Point t3;
- public:
- Polynome(const Point &p0, const Point &p1, const Point &p2);
- Point f(int k);
- };
- Тимофей Кузнецов, сегодня в 11:15
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- class Point
- {
- private:
- double x;
- double y;
- public:
- Point(double _x=0., double _y=0.);
- Point operator + (const Point &p) const;
- Point& operator += (const Point &p);
- Point operator * (const Point &p)const;
- Point& operator = (const Point&p);
- friend double distance(const Point &p1, const Point &p2);
- friend Point operator *(const double &l, const Point &p);
- virtual ~Point();
- };
- Тимофей Кузнецов, сегодня в 11:15
- #include "stdafx.h"
- #include <iostream>
- #include "point.h"
- #include <time.h>
- #include <math.h>
- Point:: Point(double _x= 0., double _y=0.){
- x = _x;
- y = _y;
- }
- Point Point:: operator +(const Point &p) const{
- Point P1;
- P1.x = x + p.x;
- P1.y = y + p.y;
- return P1;
- }
- Point& Point:: operator = (const Point&p){
- x = p.x;
- y = p.y;
- }
- Point Point:: operator *(const Point &p) const{
- Point P1;
- P1.x = x * p.x;
- P1.y = y * p.y;
- return P1;
- }
- Point& Point :: operator += (const Point &p){
- x = x*p.x;
- y = y* p.y;
- return *this;
- }
- double distance(const Point &p1, const Point &p2){
- double i = 0;
- i = p1.x - p2.x;
- double j = 0;
- j = p1.y - p2.y;
- double k = 0;
- k = sqrt(i*i + j*j);
- return k;
- }
- Point operator *(const double &l, const Point &p){
- Point p1;
- p1.x = p.x * l;
- p1.y = p.y * l;
- return p1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement