1. I need to cout my array when the values have been stored, I'm having trouble figuring out how to.
2. I also need the convert Binary To Decimal from the array that I have set up.
The over all objective of this project is converting decimal numbers to binary and binary numbers to decimal numbers.
#include <iostream> using namespace std; void binary(int); void toseeif (int); int main() { int number; toseeif (number); system ("pause"); return 0; } // Checking to see if the number entered was a positive, or below 0. void toseeif (int) { int number; cout << "Please enter a positive number: "; cin >> number; if (number < 0 || number > 250) { cout << " You have entered the a number that is out of my range! Please enter again!\n"; toseeif (number); } else { cout << number << " converted to binary is: "; binary(number); cout << endl; } } //******************************************************************** // function that converts number to binary void binary(int number) { int remainder; if(number <= 1) { cout << number; return; } remainder = number%2; binary(number >> 1); cout << remainder; } //******************************************************************** // Bool! bool* BitArray(int num) { // Set the array bool* number = new bool[8]; // Occupy the array for (int i = 0l; i < 8; i++) { number[i] = (num % 2) == 1; num >>= 1; } // Return the array return number; } //********************************************************************