this is my code:
这是我的代码:
#include <iostream>
using namespace std;
int main()
{
char character;
int x;
cout << "Input a character: " ;
cin >> character;
x = int(character);
cout << "Its integer value is: " << x << endl;
int arr[7], i=0,j;
while(x>0)
{
arr[i]=x%2;
i++;
x=x/2;
}
cout << "Its Binary format is: ";
for (j=i; j>=0;j--)
{
cout<<arr[j];
}
return 0;
}
#include <iostream