Give you a number on base ten,you should output it on base two.(0 < n < 1000)
多组输入
利用数组 先对2取模放入数组 再将原数除以2
倒序输出
#include <iostream>
#define z 1005
using namespace std;
int main()
{
int n,a[z]={};
while(cin>>n)
{int i=0;
while(n)
{
a[i++]=n%2;
n/=2;
}
while(i--)cout<<a[i];cout<<endl;
}
}