Not sure why it's not letting me choose the operation I want where I put "Enter an operation symbol..", I'm supposed to use switch statements to compute functions.
#include <iostream>
#include<cmath>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
int type;
int a, b, c, d;
char op;
cout << fixed << showpoint << setprecision(2);
//select operation
cout << "Enter a fraction: ";
cin >> a; cin.ignore(); cin >> b;
cout << "Enter another fraction: ";
cin >> c; cin.ignore(); cin >> d;
cout << "\tEnter an operation symbol (+,-, *, /): ";
cin >> op; cin.ignore();
//operate function
switch(op)
{
case '+' : cout << a << "/" << b << "+" << c << "/" << d << "=" << (a*d)+(c*b) << "/" << (d*b) << endl;
break;
case '-' : cout << a << "/" << b << "+" << c << "/" << d << "=" << (a*d)-(c*b) << "/" << (d*b) << endl;
break;
case '*' : cout << a << "/" << b << "+" << c << "/" << d << "=" << (a*c) << "/" << (d*b) << endl;
break;
case '/' : cout << a << "/" << b << "+" << c << "/" << d << "=" << (a*d) << "/" << (c*b) << endl;
break;
}
//end program
system ("pause");
return 0;
}