+ 1
Are cin and cout allowed to be used even as right hand operands?
In C ++, is it possible to swap the positions of the two operands of an input/output statement with simultaneously switching the redirection operator, in a similar way to what occurs in mathematics as regards the inequalities? Practically, I wonder for instance if writing "Hello, world!" >> cout; could be considered as correct and valid as writing cout << "Hello, world!"; .
2 odpowiedzi
+ 2
No, unless you find and use a compiler that evaluates it from the right to the left instead of left to right.
+ 1
Interesting idea:))) I am affraid, there is not so simple.
Look chapter "Operator Overloading" here in C++ course. Maybe you shall find to way how to recode for your class.. :))