Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- /*
- u*v = u1 * v1 + u2 * v2 + u3 * v3
- */
- class Wektory
- {
- public:
- double u1 = 0;
- double v1 = 0;
- Wektory(double wektorX, double wektorY, dobuleZ);
- };
- Wektory::Wektory(double wektorX, double wektorY, double wektorZ)
- {
- u = wektorX;
- v = wektorY;
- w = wektorZ;
- }
- double operator*(Wektory wek1, Wektory wek2)
- {
- return wek1.u1 * wek2.u1 + wek1.v1 * wek2.v1 + wek1.w * wek2.w;
- }
- int main(int argc, char** argv)
- {
- double x1;
- double y1;
- cout << "Podaj wektor X1:" << endl;
- cin >> x1;
- cout << "Podaj wektor Y1:" << endl;
- cin >> y1;
- Wektory wek1(x1, y1);
- cout << "Podaj wektor X2:" << endl;
- cin >> x1;
- cout << "Podaj wektor Y2:" << endl;
- cin >> y1;
- Wektory wek2(x1, y1);
- cout << "Podaj wektor X3:" << endl;
- cin >> x1;
- cout << "Podaj wektor Y3:" << endl;
- cin >> y1;
- Wektory wek3(x1, y1);
- cout << wek1*wek2;<< endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement