A c++ program which convert from decimal, octal & hexadecimal to binary equivalent with array concept.

convert the hexadecimal F9E8 into decimal

63976

Sure, I can help you with that. Here's a C++ program that converts decimal, octal, and hexadecimal numbers to their binary equivalents using arrays:

```cpp
#include <iostream>
using namespace std;

// Function to convert decimal to binary
void decimalToBinary(int decimalNumber)
{
int binaryNumber[32];
int i = 0;

while (decimalNumber > 0) {
binaryNumber[i] = decimalNumber % 2;
decimalNumber = decimalNumber / 2;
i++;
}

cout << "Binary equivalent is: ";

for (int j = i - 1; j >= 0; j--) {
cout << binaryNumber[j];
}

cout << endl;
}

// Function to convert octal to binary
void octalToBinary(int octalNumber)
{
int binaryNumber[32];
int i = 0;

while (octalNumber > 0) {
int remainder = octalNumber % 10;
int binaryDigit[3] = {0, 0, 0};
int j = 2;

while (remainder > 0) {
binaryDigit[j] = remainder % 2;
remainder = remainder / 2;
j--;
}

for (int k = 0; k < 3; k++) {
binaryNumber[i] = binaryDigit[k];
i++;
}

octalNumber = octalNumber / 10;
}

cout << "Binary equivalent is: ";

for (int j = i - 1; j >= 0; j--) {
cout << binaryNumber[j];
}

cout << endl;
}

// Function to convert hexadecimal to binary
void hexadecimalToBinary(string hexadecimalNumber)
{
int binaryNumber[32];
int i = 0;

for (int j = hexadecimalNumber.size() - 1; j >= 0; j--) {
int digit;
if (hexadecimalNumber[j] >= '0' && hexadecimalNumber[j] <= '9') {
digit = hexadecimalNumber[j] - '0';
}
else {
digit = hexadecimalNumber[j] - 'A' + 10;
}

int binaryDigit[4] = {0, 0, 0, 0};
int k = 3;

while (digit > 0) {
binaryDigit[k] = digit % 2;
digit = digit / 2;
k--;
}

for (int l = 0; l < 4; l++) {
binaryNumber[i] = binaryDigit[l];
i++;
}
}

cout << "Binary equivalent is: ";

for (int j = i - 1; j >= 0; j--) {
cout << binaryNumber[j];
}

cout << endl;
}

int main()
{
int choice, decimalNumber, octalNumber;
string hexadecimalNumber;

cout << "Enter the number system to convert from:\n";
cout << "1. Decimal\n";
cout << "2. Octal\n";
cout << "3. Hexadecimal\n";
cout << "Enter your choice: ";
cin >> choice;

switch (choice) {
case 1:
cout << "Enter the decimal number: ";
cin >> decimalNumber;
decimalToBinary(decimalNumber);
break;
case 2:
cout << "Enter the octal number: ";
cin >> octalNumber;
octalToBinary(octalNumber);
break;
case 3:
cout << "Enter the hexadecimal number: ";
cin >> hexadecimalNumber;
hexadecimalToBinary(hexadecimalNumber);
break;
default:
cout << "Invalid choice!";
}

return 0;
}
```

To convert a decimal number to binary, the program uses the `decimalToBinary()` function. The function divides the decimal number by 2 repeatedly until it becomes 0, storing the remainders in an array. Then, it prints the binary equivalent by reversing the array.

To convert an octal number to binary, the program uses the `octalToBinary()` function. The function extracts each digit of the octal number from right to left and converts it into a binary digit using a 3-element array. Then, it prints the binary equivalent by reversing the array.

To convert a hexadecimal number to binary, the program uses the `hexadecimalToBinary()` function. The function extracts each digit of the hexadecimal number from right to left, converts it into a binary digit using a 4-element array, and stores it in an array. Then, it prints the binary equivalent by reversing the array.

In the `main()` function, the program prompts the user to choose the number system to convert from (decimal, octal, or hexadecimal). Based on the choice, it asks for the corresponding number and passes it to the respective conversion function.

Finally, the program displays the binary equivalent.

Hope this helps!