Hey guys I am extremely knew to programming and I am taking my first C++ class in school right now. It seems to be going well so far, and I am trying to get practice outside of my homework assignments by doing the exercises on this page (http://www.cplusplus.com/forum/articles/12974/). I am going to post my code for each one and I would greatly appreciate any comments on how to make it better in any way. I won't Post anything unless it runs, so I am primarily looking for ways to clean up the code a little. Thanks in advance for any help!
Here is the first one:
Write a program that allows the user to enter the grade scored in a programming class (0-100).
If the user scored a 100 then notify the user that they got a perfect score.
★ Modify the program so that if the user scored a 90-100 it informs the user that they scored an A
★★ Modify the program so that it will notify the user of their letter grade
0-59 F 60-69 D 70-79 C 80-89 B 90-100 A
// This program allows the user to input a numerical grade they recieve in a class, 0-100, and it will tell them what letter grade they recieved
#include <iostream>
int main()
{
int grade;
std::cout << "Please enter the numerical grade you recieved in your programming class: ";
std::cin >> grade;
while(grade < 0 || grade > 100)
{
std::cout << " That is not a vaild entry. Please enter your grade: ";
std::cin >> grade;
}
if(grade == 100)
std::cout << "You have receieved a perfect score! A++!";
elseif(90 <= grade && grade < 100)
std::cout << "Great job! You got an A!\n";
elseif(80 <= grade && grade < 90)
std::cout << "Very nice you got a B!\n";
elseif(70 <= grade && grade < 80)
std::cout << "Not bad. You got a C.\n";
elseif(60 <= grade && grade < 70)
std::cout << "You got a D. You need to study more.\n";
elseif(grade < 60)
std::cout << "F. You have failed. Kill yourself.\n";
return 0;
}