As we know the 2nd equation of motion #include<iostream> #include<cmath> using namespace std; void main() { double vi, vf, a, s; int eq; cout << "Press 1 to solve for acceleration, 2 for distance, 3 for initial velocity and 4 for final velocity \n"; cin >> eq; if (eq == 1) { cout << "Enter vf, vi and s \n"; cin >> vf >> vi >> s; a = (pow(vf, 2) - pow(vi, 2)) / (2 * s); cout << "Acceleration is " << a << endl; } else if (eq == 2) { cout << "Enter vf, vi and a \n"; cin >> vf >> vi >> a; s = (pow(vf, 2) - pow(vi, 2)) / (2 * a); cout << "Distance is " << s << endl; } else if (eq == 3) { cout << "Enter vf, s and a \n"; cin >> vf >> s >> a; vi = sqrt(pow(vf, 2) - 2 * a*s); cout << "Initial velocity is " <...
Comments
Post a Comment