I wrote a program so the user inputs a number and the program outputs its binary representation.
I get this error:
No matching function for call to `getline(std::istream&, unsigned int&)'
How can I solve this?
Also, it outputs:
0
0
0
0
...when it should output the right value for the input.
#include <iostream>
using namespace std;
int main()
{
int Number;
cin >> Number;
bool Binary[sizeof(int) * CHAR_BIT];
for (unsigned int i = 0; i < sizeof(int) * CHAR_BIT; i++)
Binary[(sizeof(int) * CHAR_BIT - 1) - i] = Number & (1 << i);
for (unsigned int i = 0; i < sizeof(int); i++)
std::cout << Binary[i] << std::endl;
system("pause");
return 0;
}