读入写出

#include <bits/stdc++.h>
#include <fstream>
using  namespace std;
int main()
{
	freopen("a.txt","r",stdin);
	freopen("b.txt","w",stdout);
	string s;
	cin>>s;
	int a=0;
	int j,b[7];
	for(int i=0;i<s.size();i++)
	{
		a=s[i];
		for(j=0;a!=0;j++)
		{
			b[j]=a%2;
			a/=2;
		}
		for(int k=j-1;k>=0;k--)
		{
			cout<<b[k];
		}
	}
	
}

  

posted @ 2024-07-29 15:02  hanxuyao  阅读(11)  评论(0)    收藏  举报