Advertisement
SmellyBadger

Untitled

Nov 5th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. using namespace std;
  5.  
  6.  
  7.  
  8. bool IsvalidNumForBase(int, int);
  9. int baseToDecimal(int, int);
  10. float someDecimals(float, float);
  11. void decimalToBase(int, int, int &, int &);
  12. int decimalOperation(int decinum1, int decinum2, char o)
  13.  
  14. int main()
  15. {
  16. int base = 0; // the base number the user will enter
  17. int num1, num2; // integers that must be less than the base
  18. int decinum1, decinum2, opResult; // the decimal value for nums 1 and 2
  19. bool IsvalidNum = true;
  20. char op;
  21. cout << "Enter the base: " << endl;
  22. cin >> base;
  23.  
  24. IsvalidNum = IsvalidNumForBase(num1, num2);
  25. if (IsvalidNumForBase == false)
  26. {
  27. return false;
  28. }
  29.  
  30. else
  31. {
  32. cout << "Enter the first number: " << endl;
  33. cout << "Enter the second number: " << endl;
  34. cout << endl;
  35.  
  36. decinum1 = baseToDecimal(base, num1);
  37. baseToDecimal(base, num1);
  38. cout << "Decimal value for first Number: " << decinum1 << endl;
  39.  
  40. decinum2 = baseToDecimal(base, num2);
  41. baseToDecimal(base, num2);
  42. cout << "Decimal value for the second number" << decinum2 << endl;
  43.  
  44. opResult = decimalOperation(decinum1, decinum2, op);
  45. decimalOperation (decinum1, decinum2, op)
  46.  
  47. decimalToBase(decinum1, decinum2, base &, base &)
  48.  
  49. }
  50. }
  51. //params: (in, in)
  52. baseToDecimal(base, deciNum)
  53. {
  54.  
  55.  
  56. return
  57. }
  58. //params: (in, in, in/out, in/out)
  59. decimalToBase(num1, num2, base &, base &)
  60. {
  61.  
  62.  
  63.  
  64. }
  65.  
  66. //params: (in, in, in)
  67. decimalOperation(decinum1, decinum2, 'o')
  68. {
  69. if (op == '+')
  70. {
  71. opResult = decinum1 + decinum2;
  72. }
  73. else if (op == '-')
  74. {
  75. opResult = decinum1 - decinum2;
  76. }
  77. else if (op == '*')
  78. {
  79. opResult = decinum1 * decinum2;
  80. }
  81. else
  82. {
  83. opResult = decinum1 / decinum2;
  84. }
  85. return
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement