Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //*https://habrahabr.ru/post/111071/
- //*https://ru.wikipedia.org/wiki/%D0%92%D0%B5%D0%BA%D1%82%D0%BE%D1%80%D0%BD%D0%BE%D0%B5_%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%B2%D0%B5%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5
- #include <iostream>
- using namespace std;
- class Vektor{
- public:
- float x,y;
- Vektor(float x_,float y_): x(x_), y(y_){}
- void print(){
- cout << x << "\t" << y << endl;
- }
- Vektor add (Vektor b){
- return Vektor (x * b.x , y * b.y);
- }
- Vektor dot (Vektor b){
- }
- };
- int main()
- {
- Vektor a(1 ,2);
- a.print();
- Vektor b(3 ,4);
- b.print();
- Vektor c= a.add(b);
- c.print();
- return 0;
- }
- #include <iostream>
- using namespace std;
- class Vektor{
- public:
- float x,y,z;
- Vektor(float x_,float y_,float z_): x(x_), y(y_), z(z_) {}
- void print(){
- cout << x << "\t" << y << "\t" << z << endl;
- }
- Vektor add (Vektor b){
- return Vektor (x + b.x , y + b.y, z+b.z);
- }
- float dot (Vektor b){
- float d= x*b.x + y*b.y + z*b.z;
- return d;
- }
- Vektor cross(Vektor b){
- return Vektor(y*b.z-z*b.y,z*b.x-x*b.z,x*b.y-y*b.x);
- }
- };
- int main()
- {
- Vektor a(2,0,0);
- a.print();
- Vektor b(0,2,0);
- b.print();
- Vektor c = a.cross(b);
- c.print();
- return 0;
- }
Add Comment
Please, Sign In to add comment