Advertisement
Guest User

grade.cpp

a guest
Mar 23rd, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5.  
  6. {
  7.  
  8.         int grade;
  9.  
  10.  
  11.  
  12.         std::cout << "Enter your grade %: ";
  13.         std::cin >> grade;
  14.  
  15.         if (grade <= 60) {
  16.                 std::cout << "You scored an F\n"; }
  17.  
  18.  
  19.  
  20.         if (grade > 60 && grade <= 70) {
  21.                 std::cout << "You scored a D\n"; }
  22.  
  23.  
  24.         if (grade > 70 && grade <= 80) {
  25.                 std::cout << "You scored a C\n"; }
  26.  
  27.  
  28.  
  29.         if (grade > 80 && grade <= 90) {
  30.                 std::cout << "You scored a B\n"; }
  31.  
  32.  
  33.         if (grade > 90 && grade <= 100) {
  34.                 std::cout << "You scored an A!\n"; }
  35.  
  36.  
  37.                          if (grade % 10 > 0 && grade % 10 <= 3)
  38.                                 std::cout << '-';
  39.                         if (grade % 10 > 7 || grade % 10 == 0)
  40.                                 std::cout << '+';
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement