00:01
In this question, we have to write a program in c++.
00:05
So for that, we will use a switch statement like this to handle different choices.
00:18
So it prompts the user for their choice, performs the corresponding operations, and prints the results using the appropriate library functions and stream manipulators.
00:31
So it also includes error handling for valid choices.
00:34
So we have to note that here, the user will assume the input to be valid and does not include extensive input validation.
00:47
So for adding input validation and error handling is recommended in this case.
00:54
So let us see that how we are going to proceed to write the code in c++.
01:02
For that, i'll take you to a basic compiler.
01:05
And i'll show you, explain you the program here.
01:09
So first of all, the program will include the necessary header files.
01:14
So in this case, we get all these header files, which i'll explain you what they are.
01:20
So as you can see, i've mentioned in the comments that the iostream is mostly for the input output statements.
01:29
Then iomanip is for stream manipulators.
01:32
This is for mathematical functions.
01:35
And this is for the exit function that we will be using further.
01:40
So now we have to use the namespace std.
01:44
So i'll tell you what this line does.
01:48
Ok.
01:49
So this line allows us to use standard library functions and objects without specifying the std .namespace prefix.
02:00
So now let us start at the function that is by defining the main function with a choice here.
02:12
So as you can see, this main function is the entry point of the program.
02:17
Now the variable choice here is declared to store the user's menu choice.
02:23
Now the program will display the menu options that are there using the cout statement.
02:30
So let us use some cout statements to provide the user some output questions that is it.
02:39
So now as you can see, there are some questions that are to be displayed on the screen for the user.
02:49
And yes.
02:52
So as you can see here, we have started with our case.
02:58
And this is before we print and select the cosine.
03:02
So here are the piece.
03:06
This program will now display the menu options using the cout statement.
03:10
The user is prompted to enter their choice using the cin statement and the value stored in the choice variable.
03:19
So the switch statement that you can see here, switch choice, is used to handle different choices based on the value of the choice.
03:27
So we will write further cout statements.
03:34
Now we have to what we have to do now is we have to calculate and print the selected cosine.
03:40
So for that, a variable cost choice is declared here as you can see to store the user's cosine type choice that is cosine, arc cosine, or hyperbolic cosine.
03:53
So user is prompted to enter their cosine type choice using the cin statement.
04:00
That is why cin cosine choice is given here...