can anyone help me with a computer science (c++) problem ........... Write a loop that displays a table of angle measures along with their sine and cosine values. Assume that the initial and final angle measures (in degrees) are available in initDegree and finalDegree (type int variables), and that the change in angle measure between table entries is given by stepDegree (also type int variable). Remember that the cmath library’s sin and cos functions take arguments that are in radians. Write this loop using a while statement.
I'm not too familiar with C++ specific syntax, so I'll write the program in more of a logical sense. "-" will represent new lines and {"text"} will represent comments. -input 'initDegree' from user -input 'finalDegree' from user -input 'stepDegree' from user {We need to convert degrees to radians. Remember to define a variable 'pi'} -initRad = initDegree*(pi/180) -finalRad = finalDegree*(pi/180) -stepRad = stepDegree*(pi/180) {Let's begin our loop. Make three one-dimensional arrays. "angle", "cosValue", and "sinValue" or one three-dimensional array. I'll do three one-dimensional here.} - i = 1 - x = initRad - while (x < finalRad) - if x> finalRad {This will ensure the extra step the while loop takes doesn't make our angle greater than the final angle.} - break - end {if statement} - if i == 1 - angle(i) = initDegree - elseif - angle(i) = angle(i-1) + stepDegree - end {if statement} - - cosValue(i) = cos(x) - sinValue(i) = sin(x) - x = x + stepRad - i = i + 1 - end {while loop} {You'll then need to print the three arrays.}
Join our real-time social learning platform and learn together with your friends!