110,545
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <string.h>
void Select(char str[5], char *buf)
{
const int array1[] = { 1, 2, 3, 4, 5 };
const int array2[] = { 6,7, 8, 9, 10 };
const int array3[] = { 11, 12, 13,14, 15 };
const int array4[] = { 21, 22, 23,24, 25 };
const int array5[] = { 31, 42, 53, 54, 65 };
sprintf(buf, "%d%d%d%d%d", array1[str[0] - '0'], array2[str[1] - '0'], array3[str[2] - '0'], array4[str[3] - '0'], array5[str[4] - '0']);
}
int main(void)
{
char buf[100];
memset(buf, 0, 100);
Select("01234", buf);
printf(buf);
return 0;
}