Need Help with a homework assignment.

Here is my code...

#define _USE_MATH_DEFINES // for C++
#include <cmath>
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
// declaring variables:
double height, velocity, height2, time2, range;
int time, angle;

//User inputs values for defined variables:
cout << "Enter Initial Height: ";
cin >> height;
cout << "Enter Initial Velocity: ";
cin >> velocity;
cout << "Enter Elapsed Time: ";
cin >> time;

//Output of height and time based on User input:
height2 = height + velocity * time - (4.9 * pow(time,2.0));
cout << "The height at time " << time << " is " << fixed << setprecision(2) << height2 << " meters." << endl;
time2 = 2 * velocity / 9.8;
cout << "At time " << fixed << setprecision(1) << time2 << " seconds, the cannonball hits the ground." << endl;

//Leaving space between table and rest of output:
cout << " " << endl;

//Outputting table based on user input:
cout << "The following table shows the range of the cannon for a ranges" << endl;
cout << "25 to 60 in 5 degree increments." << endl;
cout << setw(15) << "Angle" << setw(15) << "Range" << endl;
angle = 25;
range = 2.0 * pow(velocity, 2.0) * sin(angle * M_PI / 180) * cos(angle * M_PI / 180) / 9.8;
cout << setw(15) << angle << setw(12) << fixed << setprecision(2) << range << endl;
angle = 30;
range = 2.0 * pow(velocity, 2.0) * sin(angle * M_PI / 180) * cos(angle * M_PI / 180) / 9.8;
cout << setw(15) << angle << setw(12) << fixed << setprecision(2) << range << endl;
angle = 35;
range = 2.0 * pow(velocity, 2.0) * sin(angle * M_PI / 180) * cos(angle * M_PI / 180) / 9.8;
cout << setw(15) << angle << setw(12) << fixed << setprecision(2) << range << endl;
angle = 40;
range = 2.0 * pow(velocity, 2.0) * sin(angle * M_PI / 180) * cos(angle * M_PI / 180) / 9.8;
cout << setw(15) << angle << setw(12) << fixed << setprecision(2) << range << endl;
angle = 45;
range = 2.0 * pow(velocity, 2.0) * sin(angle * M_PI / 180) * cos(angle * M_PI / 180) / 9.8;
cout << setw(15) << angle << setw(12) << fixed << setprecision(2) << range << endl;
angle = 50;
range = 2.0 * pow(velocity, 2.0) * sin(angle * M_PI / 180) * cos(angle * M_PI / 180) / 9.8;
cout << setw(15) << angle << setw(12) << fixed << setprecision(2) << range << endl;
angle = 55;
range = 2.0 * pow(velocity, 2.0) * sin(angle * M_PI / 180) * cos(angle * M_PI / 180) / 9.8;
cout << setw(15) << angle << setw(12) << fixed << setprecision(2) << range << endl;
angle = 60;
range = 2.0 * pow(velocity, 2.0) * sin(angle * M_PI / 180) * cos(angle * M_PI / 180) / 9.8;
cout << setw(15) << angle << setw(12) << fixed << setprecision(2) << range << endl;
return 0;
}

Every time I submit it I get these issues:
hint: First line of Angle-Range table output wrong for input 111, 222, 3.
hint: Your code did not generate the expected range output for 500.0, 10.0, 10, angle 60.
Does anybody have any idea what the problem is. Any help is greatly appreciated.
The goal of the assignment is to create a table using the setw() function that outputs the ranges of a cannon when it is shot at different angles.
Topic archived. No new replies allowed.