An angle is considered acute if it is less than 90 degrees, obtuse if it is greater than 90 degrees, and a right angle if it is equal to 90 degrees. Using this information, write a C++ program that accepts an angle, in degrees, and displays the type of angle corresponding to the degrees entered.
A student’s letter grade is calculated according to the following schedule:
Numerical grade Letter grade
Greater than or equal to 90 A
Less than 90 but greater than or equal to 80 B
Less than 80 but greater than or equal to 70 C
Less than 70 but greater than or equal to 60 D
Less than 60 F
Using this information, write a C++ program that accepts a student’s numerical grade, converts the numerical grade to an equivalent letter grade, and displays the letter grade.
1
Expert's answer
2013-03-14T13:05:37-0400
#include <iostream>
using namespace std;
int main() { /* Ask the user to enter an angle in degrees */ double angle; cout << "Enter an angle in degrees: "; cin >> angle;
/* Normalize the angle if it's bigger than 360 degrees */ while (angle > 360) angle -= 360;
/* Print the type of the angle */ if (angle == 90) cout << "The angle is right." << endl; else if (angle < 90) cout << "The angle is acute." << endl; else cout << "The angle is obtuse." << endl; return 0; }
Comments
Leave a comment