C++ help needed Hey having trouble writing this program any responces will help
ID: 670606 • Letter: C
Question
C++ help needed
Hey having trouble writing this program any responces will help thank you :
Write a program in C++ using a FOR loop that will accomplish the following items.
1.) Increment a variable named angle starting from 0 degrees up to and including 180 degrees in ten degree increments. No keyboard entry required.
2.) Use a vector magnitude of 10 and calculate the x and y components at each angle value.
3.) Output the sine, cosine, and tangent of the vector angle measured in positive trig values.
4.) Count the number of output value sets you get and output the value at each angle.
5.) Print the angles and all the calculated values to the screen.
6.) Angles will be output in degrees.
Explanation / Answer
#include <iostream.h>
#include <math.h>
//Main method//
int main()
{
int myangle, count = 0;
// sine, cosine, tangent//
//decleration of double//
double sin,cos,tan
//Print the myangles//
cout << endl << "myangles: ";
for(myangle = 0; myangle <= 180; myangle += 10)
//display the degree of cosine,sine,tangent//
cout << " " << myangle << " , ";
for(myangle = 0; myangle <= 180; myangle += 10)
{
cout << " Sine ( " << myangle << " ) = " << sin(myangle);
cout << "Cosine ( " << myangle << " ) = " << cos(myangle);
cout << "Tanget ( " << myangle << " ) = " << tan(myangle);
//Condition-vector magnitude//
if ( myangle % 30 == 0 ) cout << endl; count ++;
} // end for
cout << " Count = " << count;
return 0;
} // end main
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.