programming assignment help

Create a C++ program that calculates sin, cos, and tan of the input value that is in
degrees. You must show 6 digits below the decimal point for the output.
ELEN 1301-02 Programming Assignment #6.
Name : Your name.
Student ID : Your student ID #.
Due date : October 6, 2016
Purpose of the program :
Calculate results of trigonometric functions.
Section 1 : Enter a number in degree.
(The last 2 digits of your Student ID.)
Section 2 : Calculate sin, cos, and tan of the input value.
Section 3 : Display the results on the screen.
(You must show 6 digits below the decimal point.)
*/
// Write your own program.


and this is what I have and it's not working.
/*
ELEN 1301-02 Programming Assignment #6.
Name : .
Student ID :
Due date : October 6, 2016
Purpose of the program :
Calculate results of trigonometric functions.
Section 1 : Enter a number in degree.
(The last 2 digits of your Student ID.)
Section 2 : Calculate sin, cos, and tan of the input value.
Section 3 : Display the results on the screen.
(You must show 6 digits below the decimal point.)
*/

#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

void main()
{
int a;
double pi;
pi = 3.1415926;

//Section 1
cout << "Please type in number in degree : ";
cin >> a;

//Section 2
cout << "sin(" << a << " degrees) = " << setprecision(6) << sin(a*3.1415926/180) << endl;
cout << "cos(" << a << " degrees) = " << setprecision(6) << cos(a*3.1415926/180) << endl;
cout << "tan(" << a << " degrees) = " << setprecision(6) << tan(a*3.1415926/180) << endl;

}//main


Can you please lead me in the right direction?
Last edited on
Why is it not working?

What did you enter into the program, and with that input what output did the program produce and what do you expect the output to be?


By the way, in a C++ program main() must be defined to return an int.

it worked when I used Xcode. I started the program while i was on campus. Thank you!
Topic archived. No new replies allowed.