不知道哪里错了,求指点
  • 板块P1765 手机
  • 楼主telankesi
  • 当前回复2
  • 已保存回复2
  • 发布时间2022/11/13 17:50
  • 上次更新2023/10/27 03:04:57
查看原帖
不知道哪里错了,求指点
866969
telankesi楼主2022/11/13 17:50
#include <stdio.h>
int main() {
	char a[300];
	gets(a);
	int num=0;
	
	char *s[9] = {"abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv","wxyz"};
	for(int t = 0; t < strlen(a); t++) {
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < strlen(*(s + i)); j++) {
				if (a[t] == *(s+i)[j]) {
					num += j + 1;
				}
				else if (a[t] == ' ')num++;
			}
		}
	}
	printf("%d", num);
	return 0;
}
2022/11/13 17:50
加载中...