Advertisement
Bassel_11

Untitled

Mar 21st, 2023
509
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. /*
  2. solve the bug in the following code
  3. */
  4. #include <bits/stdc++.h>
  5. using namespace std;
  6. /*
  7.     this program check if res = num1+num2
  8.     or res = num1 - num2
  9.     and print the right operator
  10. */
  11. int main()
  12. {
  13.  
  14.     /*
  15.       i was trying to write conditional opertator to make my code looks cool
  16.       but something is wrong could you find it
  17.    */
  18.  
  19.     int num1, num2, res;
  20.     cin >> num1 >> num2 >> res;
  21.     cout << (num1 + num2 == res) : "+" : "-";
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement