class - C++ trouble with using a member function as an operand. error C2679 -


I can use some help!

This is my first course in the coding of any kind and I 'I hit my first big wall, it is with C ++ Classes I to my problem row main.cpp 1:

Error C2679: Binary '=': No operator found which operates the right hand of "zero" (or no conversion is acceptable)

My problem is that as simple as that, I have to find out that my qualitative work is applicable Why is the operation done so that I can continue my programming!

One way to note, if this is wrong then do not worry about my "result" function, because I'm still in the process of tinkering around it.

Thank you for your time.

fraction.cpp

  #include & lt; Iostream & gt; #include "fraction.h" using namespace std; Fraction: fraction () {top = 0; // default constructor below = 1; } Excerpt: fraction (int fraction, in the dynamizer) {top = fraction; Down = bottom; } Zero point: Answer () {top = numAnswer; Down = denenser; } Zero excerpt: print () const {cout & lt; & Lt; Top & lt; & Lt; "/" & Lt; & Lt; Bottom; } Zero fraction: multiplication (fraction F2) {numAnswer = top * f2.top; DenAnswer = bottom * f2.bottom; } Zero fraction :: results (answer to fraction) {cout & lt; & Lt; " is "; }  

fraction

  #include & lt; Iostream & gt; #ifndef FRACTION_H #define using FRACTION_H namespace std; Square fraction {public: fraction (); Degree (int fraction, int badge); Zero answer (); Zero print (); CONST; Multiplied by zero (fraction F2); Zero result (answer to fraction); Private: integer part; Int begua; Int top; Int bottom; Int numAnswer; Int denAnswer; }; #endif  

Main CPP

  #include & lt; Iostream & gt; #include "fraction.h" using namespace std; Int main () {fraction F1 (98); Fraction F2 (2,3); Fraction result; Cout & lt; & Lt; "The result starts"; Result.print (); Cout & lt; & Lt; Endl; Cout & lt; & Lt; "Product of"; F1.print (); Cout & lt; & Lt; "And"; F2.print (); Results = F1 Multiply By (F2); Result.print (); Cout & lt; & Lt; Endl; }  

multiplied () Should:

Degrees part: Multiply (fraction F2) {fraction answer (top, bottom); TheAnswer.top * = f2.top; TheAnswer.bottom * = f2.bottom; Return; Answers; }

You also have to change the header. Note that this solution does not modify the fraction on which you are working or f2 it just gives a new fraction with the answer in it.

You need at least one comment, which explains why you have all these members with you.

  • Top
  • You only need to top and bottom (whatever you call them)
  • Denenser
  • Denenser

  • Comments

    Popular posts from this blog

    import - Python ImportError: No module named wmi -

    Editing Python Class in Shell and SQLAlchemy -

    lua - HowTo create a fuel bar -