Hello! I have a question about how to make this compile without having any errors occur. It is a homework assignment, however, I already had it done. My hard drive went corrupt and I had to completely rewrite. I had someone from school help me with the details of it, and I can't get in with them until later this week and my professor only gave me until tomorrow to finish it. Any help would be much appreciated. currently I have this code.
(I know that asking someone to DO your homework for you is morally wrong, and I can imagine that there are rules against it on these forums, however since I've already done the majority of the work, and am just asking for specific help, I don't see the harm in it.)
This is quite long that's why I didn't include it the first time around.
Bens-MacBook-Pro:Downloads mistaacula$ gcc /Users/mistaacula/Desktop/Rational/Rational.cpp
/Users/mistaacula/Desktop/Rational/Rational.cpp:22: error: expected unqualified-id before ‘int’
/Users/mistaacula/Desktop/Rational/Rational.cpp:22: error: expected `)' before ‘int’
/Users/mistaacula/Desktop/Rational/Rational.cpp:28: error: expected unqualified-id before ‘double’
/Users/mistaacula/Desktop/Rational/Rational.cpp:28: error: expected `)' before ‘double’
/Users/mistaacula/Desktop/Rational/Rational.cpp:37: error: expected constructor, destructor, or type conversion before ‘;’ token
/Users/mistaacula/Desktop/Rational/Rational.cpp: In function ‘void add(RationalNumber&)’:
/Users/mistaacula/Desktop/Rational/Rational.cpp:44: error: ‘num’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.h:42: error: ‘int RationalNumber::den’ is private
/Users/mistaacula/Desktop/Rational/Rational.cpp:44: error: within this context
/Users/mistaacula/Desktop/Rational/Rational.cpp:44: error: ‘den’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.h:42: error: ‘int RationalNumber::num’ is private
/Users/mistaacula/Desktop/Rational/Rational.cpp:44: error: within this context
/Users/mistaacula/Desktop/Rational/Rational.h:42: error: ‘int RationalNumber::den’ is private
/Users/mistaacula/Desktop/Rational/Rational.cpp:45: error: within this context
/Users/mistaacula/Desktop/Rational/Rational.cpp:47: error: ‘prvGCD’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp: In function ‘void add(RationalNumber&, RationalNumber&)’:
/Users/mistaacula/Desktop/Rational/Rational.cpp:54: error: ‘num’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.h:42: error: ‘int RationalNumber::den’ is private
/Users/mistaacula/Desktop/Rational/Rational.cpp:54: error: within this context
/Users/mistaacula/Desktop/Rational/Rational.cpp:54: error: ‘den’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.h:42: error: ‘int RationalNumber::num’ is private
/Users/mistaacula/Desktop/Rational/Rational.cpp:54: error: within this context
/Users/mistaacula/Desktop/Rational/Rational.h:42: error: ‘int RationalNumber::den’ is private
/Users/mistaacula/Desktop/Rational/Rational.cpp:55: error: within this context
/Users/mistaacula/Desktop/Rational/Rational.cpp:57: error: ‘prvGCD’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp: In function ‘void sub(RationalNumber&)’:
/Users/mistaacula/Desktop/Rational/Rational.cpp:65: error: ‘num’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:65: error: ‘q’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:65: error: ‘den’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:68: error: ‘prvGCD’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp: In function ‘void sub(RationalNumber&, RationalNumber&)’:
/Users/mistaacula/Desktop/Rational/Rational.cpp:77: error: ‘num’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:77: error: ‘r’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:77: error: ‘den’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:80: error: ‘prvGCD’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp: In function ‘void mul(RationalNumber&)’:
/Users/mistaacula/Desktop/Rational/Rational.cpp:89: error: ‘num’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:89: error: ‘q’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:89: error: ‘den’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:92: error: ‘prvGCD’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp: In function ‘void mul(RationalNumber&, RationalNumber&)’:
/Users/mistaacula/Desktop/Rational/Rational.cpp:99: error: ‘num’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:99: error: ‘r’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:99: error: ‘den’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:102: error: ‘prvGCD’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp: In function ‘void div(RationalNumber&)’:
/Users/mistaacula/Desktop/Rational/Rational.cpp:111: error: ‘num’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:111: error: ‘q’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:111: error: ‘den’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:114: error: ‘prvGCD’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp: In function ‘void div(RationalNumber&, RationalNumber&)’:
/Users/mistaacula/Desktop/Rational/Rational.cpp:121: error: ‘num’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:121: error: ‘r’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:121: error: ‘den’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:124: error: ‘prvGCD’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp: In function ‘bool isEqual(RationalNumber&)’:
/Users/mistaacula/Desktop/Rational/Rational.cpp:133: error: ‘num’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:133: error: ‘q’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:133: error: ‘den’ was not declared in this scope
/Users/mistaacula/Desktop/Rational/Rational.cpp:136: error: expected `}' before ‘else’
/Users/mistaacula/Desktop/Rational/Rational.cpp: At global scope:
/Users/mistaacula/Desktop/Rational/Rational.cpp:136: error: expected unqualified-id before ‘else’
/Users/mistaacula/Desktop/Rational/Rational.cpp:138: error: expected declaration before ‘}’ token
sorry for being so lengthy. I'm slowly trying to figure them out one by one but I get stumped sometimes. I've already reduced the size of the list to about half. I'm just lost again.