Advertisement
avr39ripe

cppIfBasics

Jun 14th, 2021
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5.     int mark{ 4 };
  6.  
  7.     int num{};
  8.  
  9.     bool flag{};
  10.  
  11.     std::cout << "Enter your mark\n";
  12.     std::cin >> mark;
  13.  
  14.     if (flag == false)
  15.     {
  16.         // false
  17.     }
  18.     else
  19.     {
  20.         // true
  21.     }
  22.  
  23.     if (num > 0)
  24.     {
  25.         // >0
  26.     }
  27.     else
  28.     {
  29.         if (num < 0)
  30.         {
  31.             // < 0
  32.         }
  33.         else
  34.         {
  35.             // == 0
  36.         }
  37.  
  38.     }
  39.    
  40.     if (mark > 3)
  41.     {
  42.         std::cout << "You pass exam!\n";
  43.  
  44.         if (mark == 5)
  45.         {
  46.             std::cout << "Nice work!Hurra!\n";
  47.         }
  48.         else
  49.         {
  50.             std::cout << "Oh, not bad! :)\n";
  51.         }
  52.     }
  53.     else
  54.     {
  55.         std::cout << "Exam failed! Bad luck! Try again! :(\n";
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement