Please help me with this question. I have tried doing it, but there are still 2 errors that occured. Write a C++ program which ask use for:

1.an angle(in degree) for computation

2.choice of computation by typing:

'C':to coupute the cosine of an angle

'S':to computer the sine of an angle

'T':to compute the tangent of an angle

Your program must:

1.Have function Get_User_Data which gets the above-mentioned information.

2.Have function Conv_Deg2Rad which convert a degree value into radian.

3.Have function Perform_Computation which, based on the user specified preference, perform the correct computation.

4.Display the result accordingly.Below is the program that I've written.

#include <iostream.h>

#include <math.h>

#include <stdlib.h>

void Conv_Deg2Rad (double);

void Perform_Computation(char, double);void main()

{

double angle_degree;

double angle;

char Computation_Choice;

cout<< "The angle(in degree) for computation is: ";

cin>> angle_degree;

cout<< "\n";

angle = Conv_Deg2Rad (angle_degree);cout<< "The choice of computation you want to perform is:\n";

cout<< "(i) 'C' for cosine\n";

cout<< "(ii) 'S' for sine\n";

cout<< "(iii)'T' for tangent\n";

cout<< "(Please insert only the alphabet 'C', 'S', or 'T' only.)\n";

cout<< "Your choice is: ";

cin>> Computation_Choice;

Perform_Computation(Computation_Choice, angle);}

double Conv_Deg2Radian(double angle_degree1)

{

const double pi= 3.14159;

return angle_degree1 *pi/180 ;

}

void Perform_Computation (char Choice_Computation, double angle_rad)

{

double answer;if (Choice_Computation == 'C')

{

answer = cos(angle_rad);

cout<< "The answer is "<<answer<<"\n";

}

if (Choice_Computation == 'S')

{

answer = sin(angle_rad);

cout<< "The answer is "<<answer<<"\n";

}

if (Choice_Computation == 'T')

{

answer = tan(angle_rad);

cout<< "The answer is "<<answer<<"\n";

}

else

{

cout<< "Error!!!";

}

}

p/s: I'm still a beginner and only have learned several basic command. I've got only very basic knowledge on function. Thanks for helping!!!

#include <iostream.h>

#include <math.h>

#include <stdlib.h>

You really should be using the non-.h version.

void main()

main() should always return int.The first two might be ignorable, depending on your platform setup.

void Conv_Deg2Rad (double);

Should be: double Conv_Deg2Rad (double);

double Conv_Deg2Radian(double angle_degree1)

Should be: double Conv_Deg2Rad(double angle_degree1)

Thanks a lot!!! You were a great help! It really has solved my problem.

I dont understand about the 'h' version that you said, but that's what the teacher told me to write every time we write a program. The same goes to the

int main() and

void main()

But i'll try to ask my teacher about that. Thanks again!:)

Ask Your Question

Weekly Poll

Would you ride in a self-driving car from Tesla?

Discuss in The Lounge

Poll History