What's wrong with this C++ code? lain: . It's a code to find time and height using fomulas:
time=distance/ velocity*cos(theta)
height=velocity*sin(theta)*time-G*time^2/2
time=distance/ velocity*cos(theta)
height=velocity*sin(theta)*time-G*time^2/2
Code:
#include <iostream>
#include <stdio.h>
#include <math.h>
#define G 32.17
using namespace std;
int main()
{
int theta;
int distance;
int velocity;
int time;
int height;
cout<<"Enter an angle for theta: ";
cin>> theta;
cin.ignore();
cout<<"Enter a distance: ";
cin>> distance;
cin.ignore();
cout<<"Enter value for velocity: ";
cin>> velocity;
cin.ignore();
time = distance/ velocity*cos(theta);
height = velocity*sin(theta)*time-G*time^2/2;
cout<<"time is: ";
cout<< time;
cout<<" height is: ";
cout<< height;
cin.get();
}