Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <math.h>
- using namespace std;
- class Vector
- {
- private:
- float Ox1;
- float Oy1;
- float Ox2;
- float Oy2;
- public:
- Vector(float new_Ox1, float new_Oy1, float new_Ox2, float new_Oy2)
- {
- Ox1=new_Ox1;
- Oy1=new_Oy1;
- Ox2=new_Ox2;
- Oy2=new_Oy2;
- }
- void EnterVector1()
- {
- cout<<"Please, enter X"<<endl;
- cin>>Ox1;
- cout<<"Please, enter Y"<<endl;
- cin>>Oy1;
- }
- void EnterVector2()
- {
- cout<<"Please, enter X"<<endl;
- cin>>Ox2;
- cout<<"Please, enter Y"<<endl;
- cin>>Oy2;
- }
- void ShowVector1()
- {
- cout<<"(";
- cout<<Ox1;
- cout<<";";
- cout<<Oy1;
- cout<<")"<<endl;
- }
- void ShowVector2()
- {
- cout<<"(";
- cout<<Ox2;
- cout<<";";
- cout<<Oy2;
- cout<<")"<<endl;
- }
- void LenghtVector()
- {
- double a;
- a=sqrt(pow(Ox1,2)+pow(Oy1,2));
- cout<<"Lenght of the vector="<<a<<endl;
- }
- void SummaVector()
- {
- double a, b;
- a=Ox1+Ox2;
- b=Oy1+Oy2;
- cout<<"SumV";
- cout<<"(";
- cout<<a;
- cout<<";";
- cout<<b;
- cout<<")"<<endl;
- }
- void ProSVector()
- {
- double a, b, c;
- a=Ox1*Ox2;
- b=Oy1*Oy2;
- c= a+b;
- cout<<"ProSV"<<c<<endl;
- }
- void ProVVector()
- {
- double a, b;
- a=Ox1*Ox2;
- b=Oy1*Oy2;
- cout<<"ProVV";
- cout<<"(";
- cout<<a;
- cout<<";";
- cout<<b;
- cout<<")"<<endl;
- }
- };
- int main()
- {
- Vector vector (10, 10, 11, 11);
- vector.EnterVector1();
- vector.ShowVector1();
- vector.LenghtVector();
- vector.EnterVector2();
- vector.ShowVector2();
- vector.SummaVector();
- vector.ProSVector();
- vector.ProVVector();
- return 0;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement