1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
#include <iostream>
#include <cmath>
#include <math.h>
#include <stdio.h>
using namespace std;
int main()
{
int ax,ay,bx,by,cx,cy,dx,dy;
double sizea,sizeb,sizec,sized,avrg;
int array[4]={sizea,sizeb,sizec,sized};
int max = array[0];
for (int i = 0; i < 4; i++)
{
if (array[i] > max)
{
max = array[i];
}
}
cout << "Please enter Head of the Vector Fa: ";
cin >> ax >> ay;
cout << "Please enter Head of the Vector Fb: ";
cin >> bx >> by;
cout << "Please enter Head of the Vector Fc: ";
cin >> cx >> cy;
cout << "Please enter Head of the Vector Fd: ";
cin >> dx >> dy;
cout << "\n -------------------------------------";
sizea=sqrt(ax*ax+ay*ay);
sizeb=sqrt(bx*bx+by*by);
sizec=sqrt(cx*cx+cy*cy);
sized=sqrt(dx*dx+dy*dy);
avrg=(sqrt(ax*ax+ay*ay)+sqrt(bx*bx+by*by)+sqrt(cx*cx+cy*cy)+sqrt(dx*dx+dy*dy))/4;
cout << "\n Size of vector Fa is: ";
cout << sizea << endl;
cout << " Size of vector Fb is: ";
cout << sizeb << endl;
cout << " Size of vector Fc is: ";
cout << sizec << endl;
cout << " Size of vector Fd is: ";
cout << sized << endl;
cout << "\n ---------------------------------------------";
cout << "\n The Largest size from these vectors is: ";
cout << max << endl;
cout << "\n ---------------------------------------------";
cout << "\n The Average of sizes vectors are: ";
cout << avrg << endl;
cout << "\n====================================================";
int ex,ey,fx,fy,gx,gy,hx,hy;
double suma1,suma2,sumb1,sumb2,sumc1,sumc2,sumd1,sumd2;
double size1,size2,size3,size4;
cout << "\n\nPlease enter Head of the Vector Ga: ";
cin >> ex >> ey;
cout << "Please enter Head of the Vector Gb: ";
cin >> fx >> fy;
cout << "Please enter Head of the Vector Gc: ";
cin >> gx >> gy;
cout << "Please enter Head of the Vector Gd: ";
cin >> hx >> hy;
cout << "\n ------------------------------------------";
suma1=ax+ex;
suma2=ay+ey;
sumb1=bx+fx;
sumb2=by+fy;
sumc1=cx+gx;
sumc2=cy+gy;
sumd1=dx+hx;
sumd2=dy+hy;
size1=sqrt(suma1*suma1+suma2*suma2);
size2=sqrt(sumb1*sumb1+sumb2*sumb2);
size3=sqrt(sumc1*sumc1+sumc2*sumc2);
size4=sqrt(sumd1*sumd1+sumd2*sumd2);
cout << "\n The Additon of vectors Fa + Ga is: ";
cout << "(" << suma1 << "," << suma2 << ")" << endl;
cout << " The Additon of vectors Fb + Gb is: ";
cout << "(" << sumb1 << "," << sumb2 << ")" << endl;
cout << " The Additon of vectors Fc + Gc is: ";
cout << "(" << sumc1 << "," << sumc2 << ")" << endl;
cout << " The Additon of vectors Fd + Gd is: ";
cout << "(" << sumd1 << "," << sumd2 << ")" << endl;
cout << "\n ------------------------------------------";
cout << "\n Resulting force action on A is: ";
cout << size1 << endl;
cout << " Resulting force action on B is: ";
cout << size2 << endl;
cout << " Resulting force action on C is: ";
cout << size3 << endl;
cout << " Resulting force action on D is: ";
cout << size4 << endl;
return (0);
}
|