c++实现字符和十进制转换

`#include <stdio.h>

include <time.h>

include <string.h>

include <stdlib.h>

include <windows.h>

include <math.h>

int main()
{
/* code */
char str[11]={0};
int count[26]={0};

printf("请输入字符:");
for (size_t i = 0; i < 10; i++)
{
/* code */
scanf("%c",&str[i]);

}
printf("%s",str);
for (size_t j = 0; j < 11; j++)
{
/* code /
int index =str[j] -'a';
count[index]++;
}
for (size_t k = 0; k < 26; k++)
{
/
code /
if (count[k] !=0)
{
/
code */
printf("字母%c出现的次数是%d\n",('a'+k),count[k]);
int ui= 'a' +k;
printf("%d\n---",ui);
}

}

system("pause");

return 0;
}
`

image

posted @ 2024-01-21 16:20  昆仑葫芦  阅读(0)  评论(0)    收藏  举报