0

我正在尝试用 C 语言开发一个带有 Beep 功能的简单钢琴,例如“Beep(261,100);” 但我不知道如何让程序识别这个人拿着钥匙多长时间,所以它会不停地发出哔哔声。我在另一个论坛上看到过这个,但我不知道如何使用它:

if (note == 'a'){Beep(261, length);}

在程序结束时:

char notes[5] = {"a", "b", "c", "d", "e"};

int frequencies[5] = {261,130,75,32,16}; //these aren't accurate numbers but whatever

for(int i = 0; i < 5; i++){

    if (note == notes[i]){Beep(frequencies[i], length)}

}

地图会更好,但我不想实施它。概念是一样的。

4

0 回答 0