Answered step by step
Verified Expert Solution
Link Copied!

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 16). Run the program and step the code from the breakpoint until after the
value of the angle in radians has been computed. Use gdb's print command to report
the value of the input angle in radians when an input angle of 20 degrees, 1 st index =
1.33, and 2 nd index =1.0 are specified.
Add the following comments to the very beginning of the file:
// EE 1301
// HW 0
// Your name
??? Your x.500 ID
// Angle value
Replace "Your name" and "Your x.500 ID" with your actual name and ID respectively.
Replace "Angle value" with the decimal value reported by gdb in part 2.
When you are done, name the source code file username_hw0.cpp. Here, you replace
username with your x.500 ID. For example, if your university email address is
smithx1234@umn.edu, your file should be named smithx1234_hw0.cpp.
Autograder:
(4 pts) Functionality - add "in degrees" in the cout statement(s).
Manual Grading
(3 pts) Debugger - find the angle in radians, add it to the header comments
(3 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 theta1=30; // input incident angle in degrees
float n1=1.33; // input index of refraction of first medium
float n2=1; // 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 theta1_rad = theta1*M_PI/180; // converting incident angle from degrees to radians
float theta2_rad = asin((sin(theta1_rad)* n1)/ n2); // refracted angle in radians
float theta2= theta2_rad*180/M_PI; // 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

Given the utility function

Answered: 1 week ago

Question

Has your organisation defined its purpose, vision and mission?

Answered: 1 week ago