音乐变调 - 色【难度:1级】:
答案1:
using System;
static class Harmonizer
{
public static string Transpose(string noteName, int transposition)
{
string[] notes = new string[]{
"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};
int index = (12+(Array.IndexOf(notes, noteName) + transposition))%12;
return notes[index];
}
}
答案2:
using System;
static class Harmonizer
{
static string[] notes = new string[] {
"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"
};
public static string Transpose(string noteName, int transposition)
{
return notes[(12 + Array.IndexOf(notes, noteName) + transposition) % notes.Length];
}
}
答案3:
using System;
static class Harmonizer
{
public static string Transpose(string noteName, int transposition)
{
var all=new string[]{
"C", "C#",