Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp3
  8. {
  9.     class Program
  10.     {
  11.  
  12.         public string Nazwa(string par1, int par2) => par1 + par2.ToString();
  13.  
  14.         delegate void zdeleg(string cokolwiek);
  15.  
  16.         public static Dictionary<int, string> RootKey = new Dictionary<int,string>
  17.         {
  18.                 {0, "A"},
  19.                 {1, "A#"},
  20.                 {2, "B"},
  21.                 {3, "C"},
  22.                 {4, "C#"},
  23.                 {5, "D"},
  24.                 {6, "D#"},
  25.                 {7, "E"},
  26.                 {8, "F"},
  27.                 {9, "F#"},
  28.                 {10, "G"},
  29.                 {11, "G#"}
  30.         };
  31.  
  32.         static void Main(string[] args)
  33.         {
  34.             Console.WriteLine("Daj akord: ");
  35.             var input = Console.ReadLine().ToUpper();
  36.             var inputSplitted = input.Split('-').ToList();
  37.  
  38.             var inputFirstNumber = RootKey.First(x => x.Value == inputSplitted.First()).Key;
  39.             Console.WriteLine(inputFirstNumber);
  40.             Console.ReadLine();
  41.  
  42.             Dictionary<int, string> copyRootKey = new Dictionary<int, string>(RootKey);
  43.  
  44.             var index = 0;
  45.             foreach (var item in copyRootKey)
  46.             {
  47.                 if (inputFirstNumber >= index)
  48.                 {
  49.                     copyRootKey[item.Key] = RootKey[item.Key - inputFirstNumber];
  50.                 }
  51.                 if (inputFirstNumber < index)
  52.                 {
  53.                     copyRootKey[item.Key] = RootKey[RootKey.Last().Key - inputFirstNumber + index];
  54.                 }
  55.                 index++;
  56.             }
  57.  
  58.             foreach (var note in copyRootKey)
  59.             {
  60.                 Console.WriteLine(note.Key + " " + note.Value);
  61.             }
  62.  
  63.             Console.ReadLine();
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement