0

Trying to convert from binary to hex but for some reason it keeps bringing up the error instead of the output

```
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
void BintoHex (int[]);
bool CheckBin (int[], bool);
void Hexadecimal (int[]);
string hexadecimal;
void main()
{
int bin[4];
int binary;
bool reentry = true;
do
BintoHex(bin);
while (CheckBin(bin, reentry)== true);
Hexadecimal (bin);
cin>> binary;
}
void BintoHex( int bin[])
{
string Bina;
int binval;
bool loop = true;
cout<< "Enter binary value: ";
cin>> Bina;
binval = Bina.length();
//if(Bina.length() >= 33)
// cout<<"Error: Invalid character length"<<endl;
do
{
if (binval == 4)
{
for(int h = 0; h <= 4; h++)
bin[h] = Bina[h];
}
}
while (loop = false);
}
bool CheckBin(int bin[], bool reentry)
{
for (int h = 0; h < 4; h++)
if (bin[h]=='0000'||bin[h]=='0001'||bin[h]=='0010'||bin[h]=='0011'
||bin[h]=='0100'||bin[h]=='0101'||bin[h]=='0110'
||bin[h]=='0111'||bin[h]=='1000'||bin[h]=='1001'
||bin[h]=='1010'||bin[h]=='1011'||bin[h]=='1100'
||bin[h]=='1101'||bin[h]=='1110'||bin[h]=='1111')
reentry = false;
else
{
reentry = true;
h=5;
cout<< "Error: incorrect character" <<endl;
}
return reentry;
}
void Hexadecimal(int bin[])
{
for (int i = 0; i < 4; i++)
switch (bin[i])
{
case '0000':
hexadecimal=hexadecimal+ "0 ";
break;
case '0001':
hexadecimal=hexadecimal+ "1 ";
break;
case '0010':
hexadecimal=hexadecimal+ "2 ";
break;
case '0011':
hexadecimal=hexadecimal+ "3 ";
break;
case '0100':
hexadecimal=hexadecimal+ "4 ";
break;
case '0101':
hexadecimal=hexadecimal+ "5 ";
break;
case '0110':
hexadecimal=hexadecimal+ "6 ";
break;
case '0111':
hexadecimal=hexadecimal+ "7 ";
break;
case '1000':
hexadecimal=hexadecimal+ "8 ";
break;
case '1001':
hexadecimal=hexadecimal+ "9 ";
break;
case '1010':
hexadecimal=hexadecimal+ "a ";
break;
case '1011':
hexadecimal=hexadecimal+ "b ";
break;
case '1100':
hexadecimal=hexadecimal+ "c ";
break;
case '1101':
hexadecimal=hexadecimal+ "d ";
break;
case '1110':
hexadecimal=hexadecimal+ "e ";
break;
case '1111':
hexadecimal=hexadecimal+ "f ";
break;
default:
cout<< "Enter binary value " ;
}
cout<<"Your binary value in hexadecimal is: " << hexadecimal <<endl;
}
```