Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char[] alfabet = "ABCDEFGHIJKLMNOPQRSTUWXYZ".ToCharArray();
- //int[] iloscLiter = new int[25] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
- Console.WriteLine("Wprowadz tekst:");
- String tekst = Console.ReadLine();
- double[] iloscLiter = new double[25];
- for (int i = 0; i < alfabet.Length;i++) iloscLiter[i] = .0;
- int j = 0;
- int petla = 0;
- foreach ( char indeks in tekst )
- {
- bool czywszedl = false;
- while (!czywszedl)
- {
- if (Char.Equals(indeks, alfabet[j]))
- {
- iloscLiter[j] = iloscLiter[j]+1;
- //petla=petla+1;
- czywszedl = true;
- }
- else j++;
- }j = 0; petla++;
- }
- double[] Srednia = new double[25];
- for (int i = 0; i < alfabet.Length; i++)
- {
- Srednia[i] = iloscLiter[i] / tekst.Length;
- }
- double max = Srednia.Max();
- int przesuniecieDeszyfr = Srednia.ToList().IndexOf(max);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement