Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Unless you'll be maintaining an accumulated number for multiple operations, this may not be the best use of classes. For your code, you'd get the same effect by just performing these calculations within the switch statement (something similar to this). Right now, you're just using a class to contain similar functions, including a trivial output function.

Some additional notes:

Unless you'll be maintaining an accumulated number for multiple operations, this may not be the best use of classes. For your code, you'd get the same effect by just performing these calculations within the switch statement (something similar to this). Right now, you're just using a class to contain similar functions, including a trivial output function.

Some additional notes:

  • Try not to use using namespace std.
  • Indent everything within main() as well. Not doing so may make it hard to tell that the code is being contained within something.
  • You don't need <conio.h> here, so just remove it.
  • It may be useful to prevent the user from dividing by 0, which is undefined behavior.

Unless you'll be maintaining an accumulated number for multiple operations, this may not be the best use of classes. For your code, you'd get the same effect by just performing these calculations within the switch statement (something similar to this). Right now, you're just using a class to contain similar functions, including a trivial output function.

Some additional notes:

  • Try not to use using namespace std.
  • Indent everything within main() as well. Not doing so may make it hard to tell that the code is being contained within something.
  • You don't need <conio.h> here, so just remove it.
  • It may be useful to prevent the user from dividing by 0, which is undefined behavior.
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

Unless you'll be maintaining an accumulated number for multiple operations, this may not be the best use of classes. For your code, you'd get the same effect by just performing these calculations within the switch statement (something similar to this this). Right now, you're just using a class to contain similar functions, including a trivial output function.

Some additional notes:

  • Try not to use using namespace std.
  • Indent everything within main() as well. Not doing so may make it hard to tell that the code is being contained within something.
  • You don't need <conio.h> here, so just remove it.
  • It may be useful to prevent the user from dividing by 0, which is undefined behavior.

Unless you'll be maintaining an accumulated number for multiple operations, this may not be the best use of classes. For your code, you'd get the same effect by just performing these calculations within the switch statement (something similar to this). Right now, you're just using a class to contain similar functions, including a trivial output function.

Some additional notes:

  • Try not to use using namespace std.
  • Indent everything within main() as well. Not doing so may make it hard to tell that the code is being contained within something.
  • You don't need <conio.h> here, so just remove it.
  • It may be useful to prevent the user from dividing by 0, which is undefined behavior.

Unless you'll be maintaining an accumulated number for multiple operations, this may not be the best use of classes. For your code, you'd get the same effect by just performing these calculations within the switch statement (something similar to this). Right now, you're just using a class to contain similar functions, including a trivial output function.

Some additional notes:

  • Try not to use using namespace std.
  • Indent everything within main() as well. Not doing so may make it hard to tell that the code is being contained within something.
  • You don't need <conio.h> here, so just remove it.
  • It may be useful to prevent the user from dividing by 0, which is undefined behavior.
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Unless you'll be maintaining an accumulated number for multiple operations, this may not be the best use of classes. For your code, you'd get the same effect by just performing these calculations within the switch statement (something similar to this). Right now, you're just using a class to contain similar functions, including a trivial output function.

Some additional notes:

  • Try not to use using namespace std.
  • Indent everything within main() as well. Not doing so may make it hard to tell that the code is being contained within something.
  • You don't need <conio.h> here, so just remove it.
  • It may be useful to prevent the user from dividing by 0, which is undefined behavior.
lang-cpp

AltStyle によって変換されたページ (->オリジナル) /