syntax - Error in job Build for constructing C++ program to determine range -


i till experiencing issues until made change formula gravity. working now. everyone. appreciate great feedback

    #include <iostream>     #include <string>     #include <cstdlib>     #include <cmath>      using namespace std;      int main()     {         // initialize objects:              double angle = 0.0;         double velocity = 0.0;          double range = 0.0;         const double pi = 3.141592653589793238;         const double gravity = 9.8; //meters pers second          // input:          cout << "takeoff angle: ";         cin >> angle;         cout << "please enter velocity: ";         cin >> velocity;          // process          angle = angle * pi / 180;         range = sin(2 * angle) * velocity * velocity / gravity;          cout << " range " << range << endl;         system("pause");          return 0;  } 

range = sin(* angle)*velocity pow(2); 

this not valid c++.

pow function takes 2 arguments. x^y represented pow(x, y).

also, sin(*angle) invalid angle neither pointer nor class defined * operator.

i think you're looking for:

range = sin(2 * angle) * velocity * velocity / gravity; // (no need use pow(velocity, 2) on velocity * velocity) 

(this correct formula range)


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -