Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- bool IsvalidNumForBase(int, int);
- int baseToDecimal(int, int);
- float someDecimals(float, float);
- void decimalToBase(int, int, int &, int &);
- int decimalOperation(int decinum1, int decinum2, char o)
- int main()
- {
- int base = 0; // the base number the user will enter
- int num1, num2; // integers that must be less than the base
- int decinum1, decinum2, opResult; // the decimal value for nums 1 and 2
- bool IsvalidNum = true;
- char op;
- cout << "Enter the base: " << endl;
- cin >> base;
- IsvalidNum = IsvalidNumForBase(num1, num2);
- if (IsvalidNumForBase == false)
- {
- return false;
- }
- else
- {
- cout << "Enter the first number: " << endl;
- cout << "Enter the second number: " << endl;
- cout << endl;
- decinum1 = baseToDecimal(base, num1);
- baseToDecimal(base, num1);
- cout << "Decimal value for first Number: " << decinum1 << endl;
- decinum2 = baseToDecimal(base, num2);
- baseToDecimal(base, num2);
- cout << "Decimal value for the second number" << decinum2 << endl;
- opResult = decimalOperation(decinum1, decinum2, 'o');
- decimalOperation (decinum1, decinum2, 'o')
- }
- }
- //params: (in, in)
- baseToDecimal(base, deciNum)
- {
- return
- }
- //params: (in, in, in/out, in/out)
- decimalToBase(num1, num2, base &, base &)
- {
- }
- //params: (in, in, in)
- decimalOperation(decinum1, decinum2, 'o')
- {
- if (op == '+')
- {
- opResult = decinum1 + decinum2;
- }
- else if (op == '-')
- {
- opResult = decinum1 - decinum2;
- }
- else if (op == '*')
- {
- opResult = decinum1 * decinum2;
- }
- else
- {
- opResult = decinum1 / decinum2;
- }
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement