Advertisement
SmellyBadger

Untitled

Nov 5th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 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, 'o');
  45. decimalOperation (decinum1, decinum2, 'o')
  46.  
  47. }
  48. }
  49. //params: (in, in)
  50. baseToDecimal(base, deciNum)
  51. {
  52.  
  53.  
  54. return
  55. }
  56. //params: (in, in, in/out, in/out)
  57. decimalToBase(num1, num2, base &, base &)
  58. {
  59.  
  60.  
  61.  
  62. }
  63.  
  64. //params: (in, in, in)
  65. decimalOperation(decinum1, decinum2, 'o')
  66. {
  67. if (op == '+')
  68. {
  69. opResult = decinum1 + decinum2;
  70. }
  71. else if (op == '-')
  72. {
  73. opResult = decinum1 - decinum2;
  74. }
  75. else if (op == '*')
  76. {
  77. opResult = decinum1 * decinum2;
  78. }
  79. else
  80. {
  81. opResult = decinum1 / decinum2;
  82. }
  83. return
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement