|
-
September 6th, 2012, 02:27 AM
#6
Re: Returning Operator to Switch Statement
 Originally Posted by D_Drmmr
oper is an integer, so the cin will fail if the user enters valid input. Use a char instead. Also, you are asking the user to enter the operator twice.
Furthermore:
- Why do you have a global variable 'c'?
- Keep input/output out of classes that have nothing to do with it. Your fraction class should not have functions that use input/output. Either overload the stream operators or use some global functions.
- Your classes are not const-correct.
- Your operators are not implemented correctly.
I used global variable for input where user input int/int in console screen and 'c' is for user choice like 2/5 or 2:5..
Const-correct? Pardon. It mean, my classes are not constant?
Yah, i am pretty much sure, my operator are not implemented correctly, but, i am confused how to implement it..
Can you help me ?
Regards
Basanta
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|