#include <iostream>
usingnamespace std;
int mult ( int x, int y );
int divide (int x, int y );
int main()
{
for (;;) {
int x;
int y;
char mode;
char m;
char d;
cout<<"Please input mode (m for multiply, d for divide): ";
cin>> mode;
cin.ignore();
if ( mode == m ) {
cout<<"Please input two numbers to be multiplied: ";
cin>> x >> y;
cin.ignore();
cout<<"The product of your two numbers is "<< mult ( x, y ) <<"\n";
}
elseif ( mode == d ) {
cout<<"Please input two numbers to be divided: ";
cin>> x >> y;
cin.ignore();
cout<<"The quotient of your two numbers is "<< divide ( x, y ) <<"\n";
}
}
cin.get();
}
int mult ( int x, int y )
{
return x * y;
}
int divide ( int x, int y )
{
return x / y;
}
I was trying to make it so that when the user types m or d into the console after asked to input a mode it would set the char mode variable to whatever they had input, then if mode was equal to m it would trigger the multiply code, if it were d it would trigger the divide code, and I have no idea what would happen if it were anything other than those two things