Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 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 Exc._9.Index_of_Letters
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string input = Console.ReadLine();
  14. char[] arrinput = input.ToCharArray();
  15.  
  16. for (int i = 0; i < arrinput.Length; i++) //purvo re6enie
  17. {
  18. Console.WriteLine(arrinput[i] + " -> " +((int)(arrinput[i]) - 97));
  19. }
  20. return;
  21.  
  22.  
  23.  
  24. var alphabet = new char[26]; //vtoro reshenie
  25. int count=0;
  26.  
  27. for (char i = 'a'; i < 'z'+1; i++)
  28. {
  29. alphabet[count] = i;
  30. count++;
  31. }
  32.  
  33. for (int i = 0; i < arrinput.Length; i++)
  34. {
  35. for (int i2 = 0; i2 < alphabet.Length; i2++)
  36. {
  37. if (arrinput[i] == alphabet[i2])
  38. {
  39. Console.WriteLine(arrinput[i] + " -> " + ((int)(arrinput[i])-97));
  40. }
  41. }
  42. }
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement