so I have a problem, I can not figure it out and i will be glad if somebody can give me a hand with my code. So I am converting a Byte into Bit using INPUT and OUTPUT function and my problem is that i can not find a way to automatically use the result (the output) to calculate it in binary also. So if I want to convert 50 B to bits I will get 400 as a result and these 400 bits (numbit) i want them to show up like binary also. This is my code:
#include<iostream>
#include<conio.h>
using namespace std;
main()
{
int numB, numbit;
int arr [100], i = 0,j;
//INPUT
cout<<"Please Enter the number of Bytes:";
cin>>numB;
cout<<"\n";
//Formula bytes into bits
numbit = numB * 8;
//OUTPUT
cout<<"Is equal to the number of bits:"<<numbit;
cout<<"\n";
while (numbit>0)
{
arr [i] = numbit%2;
i++;
numbit=numbit/2;
}
cout<<"Binary number is: ";
for (j= i-1; j>=0; j--)
{
cout<< arr[j];
return 0;
system("Pause");
}
}