#include <cstdlib>
#include <iostream>
using namespace std;
class fractions
{
private:
int numerator1, denominator1, numerator2, denominator2;
public:
fractions(int = 0, int = 1, int = 0, int = 1);
void read_fractions ();
void multiply_fractions ();
void add_fractions ();
double add_fractions (double);
double multiply_fractions (double);
};
void fractions::read_fractions ()
{
cout << " Enter numerator and denominator for first fraction." << endl;
cin >> numerator1 >> denominator1;
cout << " Enter numerator and denominator for the second fraction." << endl;
cin >> numerator2 >> denominator2;
cout << "Your fractions are " << numerator1 "/" << denominator1 ;
cout << "and" << numerator2 "/" << denominator2 << endl;
}
void fractions::add_fractions
{
double sum_result;
sum_result = ((numerator1*denominator2)+(numerator2*denominator1))
/denominator1*denominator2;
return (sum_result);
}
void fractions::multiply_fractions
{
double product;
product = (numerator1*numerator2)/(denominator1*denominator2);
return (product);
}
int main()
{ double sum, product;
sum = sum_result;
cout << "The sum of the two fractions are " << sum << endl;
product = product_result;
cout << "The product of the two fractions are " << product << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Lot's of problems here and I can't seem to solve one.
First in line 26 the error is "expected ';' before string constant"
second on line 32 the error is " invalid function declaration" (also on line 40)
There are more so if anyone wants to chime in and help out with whatever you may see all help is appreciated.