超碰大妈:2编程实现输入一个正整数,输出其对应的二进制数和十六进制数,要求轮换过程用自编函数来实现。
来源:百度文库 编辑:中科新闻网 时间:2024/10/06 22:39:44
希望大家帮帮忙,不胜感激!!
这个程序只能转化成1到16进制数
#include <stdio.h>
void main()
{
long m;
int i=0,d,n,a[50],b[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
printf("please input the munber:\n");
scanf("%ld",&m);
printf("please input the base:\n");
scanf("%d",&n);
do{a[i]=m%n;i++;}while((m/=n)!=0);
printf("the new number is:\n");
for(--i;i>=0;i--)
{d=a[i];printf("%c ",b[d]);
}
printf("\n");
}
我也是刚刚学C,还请高手多多指教!!在VC上已经运行成功!
送你四个字:太不讲就!!!以后都不会再帮你!
2编程实现输入一个正整数,输出其对应的二进制数和十六进制数,要求轮换过程用自编函数来实现。
c++语言编程将输入的正整数按反序输出,例如:输入123,则输出321。
用C++编程将输入的正整数按反序输出,例如:输入123,则输出321。
利用C++如何编程:编程将输入的正整数按反序输出,例如:输入123,则输出321。
给出一个正整数,编程实现:从低位到高位顺序输出每位数字,以及位数。
c语言: 输入一个十进制正整数,将其转换成八进制数,并输出结果。
一条关于编程的题目:输入一个整数,输出其反序。
c ,编程。输入一个小于1000的正整数,计算它各位上的数字之和。例,输入234,输出结果为9。
(1) 编程, 把从键盘上输入的一个十进制整数,转换为对应的八进制数字串输出。
编程,键盘上输入一个不大于99999的正整数,判断其是一个几位数,并按逆序输入各位数字.运行界面自己设计