run compiler w/o precompiled headers
Bug: It says my exponent operator is incorrect, how do i fix this? Thanks
#include <iostream>
using namespace std;
//Math functions
#include <cmath>
//Function prototype compute_range()
double compute_range(double angle, double velocity);
//Function prototype show_results()
void show_results(double range);
int main()
{
//boolean condition set to false
bool cont = false;
//Intialized variables
char answer = 'y';
double angle, velocity, range;
//do while loop
do{
cout << "Please input an angle in degrees: ";
cin >> angle;
cout << endl;
cout << "Please input velocity in meters per second: ";
cin >> velocity;
cout << endl;
range = compute_range(angle, velocity);
show_results(range);
cout << "Continue (y/n) ? ";
cin >> answer;
cont = (answer == 'y');
//End while
}while(cont);
return 0;
}
/************************************************** */
//Function call computer_range()
double compute_range(double angle, double velocity){
double const GRAVITY = 9.8;
double range;
range = sin(2 * angle) * velocity^2 / GRAVITY;
return(range);
}
/************************************************** */
/*************************************/
//Function call show_results()
void show_results(double range){
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(1);
cout << "The range is: " << range;
return;
}
/*************************************/