Write a complete program that: 1. Creates a global constant to hold pi (n= 3.141592). 2. Prompts the user to enter an angle in degrees then reads in an angle in degrees from the keyboard as a double. 3. Converts the angle from (2) to radians. 4. Computes the sine of the angle from (3) using . 5. Computes the cosine of the angle from (3) using . 6. Computes the tangent of the angle from (3) using . 7. Writes the answers from (3) (4) (5) and (6) out to the display. The formula to convert degrees to radians is: degrees * pi radians 180 The prototypes for sin() and cos() are: 1. double sin (double x); 2. double cos (double x); 3. double tan (double x); See the example output for examples and formatting. Example Output An example of an interaction with your program is shown below, your output should match these examples exactly. (The words printed in blue are from the computer, based on your commands, the words in red are user input. Note: these colors are simply here to distinguish components and not needed in your program.): Example 1 Alexs-iMac:lab3a alex$ g++ -Wall -pedantic main.cpp Alexs-iMac:lab3a alex$ ./a.out Enter an angle value, in degrees **10 10 degrees = 0.174533 radians sin (10) = 0.173648 cos (10) = 0.984808 tan (10) == 0.176327

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write in C++

Write a complete program that:
1. Creates a global constant to hold pi (n= 3.141592).
2. Prompts the user to enter an angle in degrees then reads in an angle in degrees from the keyboard as a double.
3. Converts the angle from (2) to radians.
4. Computes the sine of the angle from (3) using <cmath>.
5. Computes the cosine of the angle from (3) using <cmath>.
Computes the tangent of the angle from (3) using <cmath>.
7. Writes the answers from (3) (4) (5) and (6) out to the display.
6.
The formula to convert degrees to radians is:
radians
degrees * pi
180
The prototypes for sin() and cos() are:
1. double sin(double x);
2. double cos(double x);
3. double tan (double x);
See the example output for examples and formatting.
Example Output
An example of an interaction with your program is shown below, your output should match these examples exactly. (The words
printed in blue are from the computer, based on your commands, the words in red are user input. Note: these colors are simply
here to distinguish components and not needed in your program.):
Example 1
Alexs-iMac:lab3a alex$ g++ -Wall -pedantic main.cpp
Alexs-iMac:lab3a alex$ ./a.out
Enter an angle value, in degrees
**10
10 degrees = 0.174533 radians
sin (10) = 0.173648
cos (10) = 0.984808
tan (10) = 0.176327
Transcribed Image Text:Write a complete program that: 1. Creates a global constant to hold pi (n= 3.141592). 2. Prompts the user to enter an angle in degrees then reads in an angle in degrees from the keyboard as a double. 3. Converts the angle from (2) to radians. 4. Computes the sine of the angle from (3) using <cmath>. 5. Computes the cosine of the angle from (3) using <cmath>. Computes the tangent of the angle from (3) using <cmath>. 7. Writes the answers from (3) (4) (5) and (6) out to the display. 6. The formula to convert degrees to radians is: radians degrees * pi 180 The prototypes for sin() and cos() are: 1. double sin(double x); 2. double cos(double x); 3. double tan (double x); See the example output for examples and formatting. Example Output An example of an interaction with your program is shown below, your output should match these examples exactly. (The words printed in blue are from the computer, based on your commands, the words in red are user input. Note: these colors are simply here to distinguish components and not needed in your program.): Example 1 Alexs-iMac:lab3a alex$ g++ -Wall -pedantic main.cpp Alexs-iMac:lab3a alex$ ./a.out Enter an angle value, in degrees **10 10 degrees = 0.174533 radians sin (10) = 0.173648 cos (10) = 0.984808 tan (10) = 0.176327
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education