Skip to main content
3 of 4
More explanation
Tolani
  • 2.5k
  • 7
  • 30
  • 49

As I'm not a guru yet in C++, here are few pointers

  • Function names should start with lowercase letters e.g Minus() should be minus
  • There is no need to have int has a return type for your function. void is a valid return type and it means return nothing. This would save you the lines of return 0
  • Your divide and multiply functions may be prone to erroneous output. This casts your answer to int
  • Avoid using namespace std because when you use additional libraries clashes may occur. Instead use qualified names e.g std::cout, std::endl etc
  • I see duplicate codes, DRY up your main function. Make first and second numbers global so this can be read once and it's outside your if statement
  • At this point, I will opt for a switch statement to make your main cleaner
  • To make this robust, you probably have to check for if invalid input was typed by the user
Tolani
  • 2.5k
  • 7
  • 30
  • 49