Advertisement
Raizekas

Untitled

Jan 26th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. static string RikiuotaEilutė(string rezultatuEilute)
  2.         {
  3.             string rezas = "";
  4.             char rikiuota=' ';
  5.             string alfabetas = "aąbcčdeęėfghiįyjklmnoprsštuųūvzž";
  6.             char[] rezultatass = rezultatuEilute.ToCharArray();
  7.  
  8.             for (int i = 0; i < rezultatass.Length-1; i++)
  9.             {
  10.                 for(int j=i+1; j<rezultatass.Length; j++)
  11.                 {
  12.                     if (alfabetas.IndexOf(rezultatass[i]) > alfabetas.IndexOf(rezultatass[j]))
  13.                     {
  14.                         if (alfabetas.IndexOf(rezultatass[i]) != -1 && alfabetas.IndexOf(rezultatass[j]) != -1)
  15.                         {
  16.                             rikiuota = rezultatass[i];
  17.                             rezultatass[i] = rezultatass[j];
  18.                             rezultatass[j] =rikiuota;
  19.                         }
  20.                     }
  21.                 }
  22.             }
  23.             for (int i = 0; i < rezultatass.Length; i++)
  24.                 rezas += rezultatass[i];
  25.             return rezas;
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement