文件名称:jinzhizhuanhuan
- 所属分类:
- 其他小程序
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2013-12-07
- 文件大小:
- 354kb
- 下载次数:
- 0次
- 提 供 者:
- 服***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
【问题描述】编写函数itob(n,s,b),用于把整数n转换成以b为基的字符串并存储到s中. 编写程序,使用函数itob(n,s,b)将输入的整数n,转换成字符串s,将s输出.转换后的字符串从最高的非零位开始输出。如果n为负数,则输出的字符串的第一个字符为’-’。b为大于1小于37的任意自然数值。当b=2时,输出字符只可能是’0’和’1’;当b=16时,输出字符串中可能含有字符为’0’-’9’,’a’-’f’(字母以小写输出)。b还可以是其它数值。比如输入n=33,b=17,则输出33的17进制值为"1g"。
【输入形式】控制台输入整数n和b,其中n可以为负数。n和b以空格分隔.
【输出形式】控制台输出转化后的字符串s.
【样例输入】5 2
【样例输出】101
【样例说明】5的二进制就是101
【评分标准】结果完全正确得20分,每个测试点4分。提交程序名为:itob.c-[Problem Descr iption] Write a function itob (n, s, b), is used to convert the integer n base b string and stored in s. Written procedures, use the function itob (n, s, b) the input integer n, converted to a string s, the s output. strings converted from the highest non-zero bit to start output. If n is negative, the first character of the output is - . b is greater than a value of less than 37 of any nature. When b = 2, the output character can only be 0 and 1 When b = 16, the output string may contain characters 0 - 9 , a - f (letter in lower output). b may also be other values . For example, enter n = 33, b = 17, the output 17 hex value "1g" 33 s.
[Form] input console input integer n and b, where n can be negative. n and b separated by a space.
[Output format] console output after conversion string s.
Sample input [52]
Sample output] 101
[Descr iption] binary sample 5 is 101
[Standard] results entirely correct score 20 points, 4 points for each test poin
【输入形式】控制台输入整数n和b,其中n可以为负数。n和b以空格分隔.
【输出形式】控制台输出转化后的字符串s.
【样例输入】5 2
【样例输出】101
【样例说明】5的二进制就是101
【评分标准】结果完全正确得20分,每个测试点4分。提交程序名为:itob.c-[Problem Descr iption] Write a function itob (n, s, b), is used to convert the integer n base b string and stored in s. Written procedures, use the function itob (n, s, b) the input integer n, converted to a string s, the s output. strings converted from the highest non-zero bit to start output. If n is negative, the first character of the output is - . b is greater than a value of less than 37 of any nature. When b = 2, the output character can only be 0 and 1 When b = 16, the output string may contain characters 0 - 9 , a - f (letter in lower output). b may also be other values . For example, enter n = 33, b = 17, the output 17 hex value "1g" 33 s.
[Form] input console input integer n and b, where n can be negative. n and b separated by a space.
[Output format] console output after conversion string s.
Sample input [52]
Sample output] 101
[Descr iption] binary sample 5 is 101
[Standard] results entirely correct score 20 points, 4 points for each test poin
(系统自动生成,下载前可以参看下载内容)
下载文件列表
getprimenum
...........\Debug
...........\.....\getprimenum.exe
...........\.....\getprimenum.ilk
...........\.....\getprimenum.obj
...........\.....\getprimenum.pch
...........\.....\getprimenum.pdb
...........\.....\itob.exe
...........\.....\itob.ilk
...........\.....\itob.obj
...........\.....\itob.pch
...........\.....\itob.pdb
...........\.....\vc60.idb
...........\.....\vc60.pdb
...........\getprimenum.dsp
...........\getprimenum.dsw
...........\getprimenum.ncb
...........\getprimenum.opt
...........\getprimenum.plg
...........\itob.c
...........\itob.dsp
...........\itob.dsw
...........\itob.ncb
...........\itob.opt
...........\itob.plg