#include <iostream>
#include <cstring>
#include <string>
#include <cstdlib>
#include <iomanip>
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>


using namespace std;

class Fraction
{
      private:
              double numerator;
              double denominator;
      public:
             Fraction ();
            // Fraction (double numerator, double denominator);
             //Fraction (Fraction &);
             //double operatorMultiply (fraction a, fraction b);
             //double operatorSum ();
             //double operatorDouble ();
             //double operatorEqual (Fraction &);
             //double operatorSet (Fraction &);
             double getNumerator ();
             void setNumerator (double);
             double getDenominator ();
             void setDenominator (double);
};

Fraction::Fraction () {
 setNumerator(99999999);
 setDenominator(99999999);
}

void Fraction::setNumerator(double numeratorArg){
 if(numeratorArg > 0){
numerator = numeratorArg;
 }
}

double Fraction::getNumerator(){
return numerator;
}

void Fraction::setDenominator(double denominatorArg){
 if(denominatorArg > 0){
 denominator = denominatorArg;
 }
}

double Fraction::getDenominator(){
return denominator;
}

void printintromsg()
{
     cout << "This application adds and multiplies fractions." << endl;
     cout << " " << endl;
}

int main (int argc, char *argv[]){
	double tempNumerator1;
    double tempDenominator1;
    double tempNumerator2;
    double tempDenominator2;
    char contFlag;
    int UserResponse;

	Fraction numerator1, numerator2, denominator1, denominator2;
	
	printintromsg();
	
    do
    {
             
	     cout << "Enter an integer for the numerator: ";
         cin >> tempNumerator1;
         cout << " " << endl;
         numerator1.setNumerator(tempNumerator1);
         cout << "Enter an integer for the denominator: ";
         cin >> tempDenominator1;
         denominator1.setDenominator(tempDenominator1);
         cin.ignore(80, '\n');
         cout << endl;

         cout << "Enter an integer for the numerator: ";
         cin >> tempNumerator2;
         cout << " " << endl;
         numerator2.setNumerator(tempNumerator2);
         cout << "Enter an integer for the denominator: ";
         cin >> tempDenominator2;
         denominator2.setDenominator(tempDenominator2);
         cin.ignore(80, '\n');
         cout << endl;
         
         cout << "Enter + or * ";
         cin >> UserResponse;
         
              if(UserResponse = '+'){
                              
                              cout << (tempNumerator1 + tempNumerator2 ) << "/" << (tempDenominator1 + tempDenominator2 ) << endl;
                                   }
              else if (UserResponse = '*'){
                                   cout << (tempNumerator1 * tempNumerator2 ) << "/" << (tempDenominator1 * tempDenominator2 ) << endl;
                                  }
              else{
                                  cout << "invalid input" << endl;
                                  } 
                                                
                              

         if ((tempNumerator1 == tempNumerator2) && (tempDenominator1 == tempDenominator2))
         {
         cout << "They are equal." << endl;
         }
         else
         {
       cout << "They are not equal." << endl;
       }

       cout << "Continue? ";
       cin >> contFlag;
       cin.ignore(80, '\n');
    }
    

   while((contFlag == 'Y' || contFlag == 'y'));;

  system("PAUSE");
  return 0;
}

The coded out stuff will be worked on later but at the moment I just want what I have coded to work.

My problems are that no matter if I choose + or *, it only adds it wont multiply. Next problem is that it isnt prompting me to continue it just says "press anykey to quit" I need to be able to have the user enter an infinite number of fractions.

Please help!

This question has already been answered. Start a new discussion instead.