其他pta题目见我的专栏,有sduwh的全套C语言pta题目及答案
6-1 exercise 2-3
分数 20
全屏浏览题目
切换布局
作者 sduwh_yh
单位 山东大学(威海)
Write the function htoi(s), which converts a string of hexadecimal
digits(including an optional 0x or 0X)into its equialent integer value.
The allowable digits are 0 through 9,a through f,and A through F.
We make sure the 'int' type is enough.
函数接口定义:
int htoi(char s[]);
裁判测试程序样例:
#include <stdio.h>
#define YES 1
#define NO 0
/* htoi:convert hexadecimal string s to integer */
int htoi(char s[]);
int main()
{
// freopen("2.in", "r", stdin);
// freopen("2.out", "w", stdout);
char A[12];
while(scanf("%s", A) != EOF) {
int v &