I am working on a much more complex program than I am used to and I have no idea why << in my cout statement, and < in a if statement will not work. Any advice on the program overall will be helpful also! Thanks!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include "151fraction.h"
#include <iostream>
usingnamespace std;
int main(){
Fraction one(1,2);
Fraction two(2,3);
(one.print()) ;
Fraction product = one.multiply(two);
product.print();
Fraction added =one.add(two);
added.print();
Fraction subtracted = one.subtract(two);
subtracted.print();
Fraction divided = one.divide(two);
cout<< "When the fractions are divided the answer is: " << divided.print() << endl;
return 0;
}
There is no use to pass void to cout. Just place divided.print() routine in their own statement.
As for if, your parenthesises in condition aren't balanced. just remove them all and olace where needed.