#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int count;
int x,i,j;
int a[20];
cout << "请输入一个十进制整数:"<<endl;
cin >> x;
for(count=0;count<=20;count++)
{
i = x / 2;
j = x % 2;
a[count] = j;
x = i;
}
cout << "转换成二进制后:" << endl;
for (count=20; count >= 0; count--)
cout << a[count];
cout << endl;
return 0;
}
最后
以上就是活力大侠最近收集整理的关于实验2:十进制转二进制 (使用数组)(补)的全部内容,更多相关实验2:十进制转二进制内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复