Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Compile the program with debug flags and use gdb to debug the program. Set a breakpoint somewhere before the line that computes the value of
Compile the program with debug flags and use gdb to debug the program. Set a
breakpoint somewhere before the line that computes the value of the input angle in
radians line Run the program and step the code from the breakpoint until after the
value of the angle in radians has been computed. Use gdbs print command to report
the value of the input angle in radians when an input angle of degrees, st index
and nd index are specified.
Add the following comments to the very beginning of the file:
EE
HW
Your name
Your x ID
Angle value
Replace "Your name" and "Your ID with your actual name and ID respectively.
Replace "Angle value" with the decimal value reported by gdb in part
When you are done, name the source code file usernamehwcpp Here, you replace
username with your ID For example, if your university email address is
smithx@umn.edu, your file should be named smithxhwcpp
Autograder:
pts Functionality add in degrees" in the cout statements
Manual Grading
pts Debugger find the angle in radians, add it to the header comments
pts Coding Style header and comments with your name, etc.
c C code in which input values are defined without asking the user to enter values:
#include
#include
using namespace std;
int main
float theta; input incident angle in degrees
float n; input index of refraction of first medium
float n; input index of refraction of second medium
As the sin function in cmath takes the input in radians so we need to convert our degree angle to radians
float thetarad thetaMPI; converting incident angle from degrees to radians
float thetarad asinsinthetarad n n; refracted angle in radians
float theta thetaradMPI; converting refracted angle from radians to degree
cout"Input incident angle in degrees:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started