小编Afr*_*aut的帖子

有没有办法从数组中读取字符,然后在 c 中的预定义枚举中查找它的值?

我正在编写一个程序来计算拼字游戏中的单词得分,代码如下:

#include <stdio.h> 

int main() {
    
    // 1. Input at word 
    unsigned char word[15];
    printf("Enter a word: \n");
    scanf("%s", word);
    printf("The word you entered is: %s\n", word);
    
    // 2. Convert each character in the word to it's letter value
    enum letterValue {a = 1, A = 1, e = 1, E = 1, i = 1, I = 1,  o = 1, O = 1, u = 1, U = 1, l = 1, L = 1, n = 1, …
Run Code Online (Sandbox Code Playgroud)

c arrays variables enums char

3
推荐指数
1
解决办法
75
查看次数

标签 统计

arrays ×1

c ×1

char ×1

enums ×1

variables ×1