ASCII
Jednoduchý ASCII zobrazovač a konverter
C# .NET
while (true)
{
Console.Clear();
Console.WriteLine(@" ___ _______ ______ __ __ ");
Console.WriteLine(@" / \ / | / || | | | ");
Console.WriteLine(@" / ^ \ | (----`| ,----'| | | | ");
Console.WriteLine(@" / /_\ \ \ \ | | | | | | ");
Console.WriteLine(@" / _____ \ .----) | | `----.| | | | ");
Console.WriteLine(@"/__/ \__\ |_______/ \______||__| |__| ");
Console.WriteLine("\n");
string abeceda = "abcdefghijklmnopqrstuvwxyz";
for(int j = 0; j < (abeceda.Length / 2); j++) { // Opakuj cyklus jak-je-dlouha-abeceda deleno dvema
if(abeceda[j] == 'a' || abeceda[j] == 'b' || abeceda[j] == 'c') // Kdyz je vlevo na radku a, b, nebo c, bude priprsana jedna mezera (z duvodu grafiky)
Console.WriteLine("{0} | {1} {2} | {3}", abeceda[j], (int)abeceda[j], abeceda[j + 13], (int)abeceda[j + 13]); // Vypis vlevo pismeno | ascii a napravo to same, s posunem o 13
else
Console.WriteLine("{0} | {1} {2} | {3}", abeceda[j], (int)abeceda[j], abeceda[j + 13], (int)abeceda[j + 13]); // Vypis vlevo pismeno | ascii a naprov to same, s posunem o 13
}
Console.WriteLine("\n\nZadej: \n[C] islo\n[T] ext");
char volba = Console.ReadKey(true).KeyChar;
switch (volba)
{
case 'c':
Console.Clear();
Console.WriteLine("Zadej cisla, oddeluj je od sebe mezerou!");
string vstup = Console.ReadLine();
Console.WriteLine("\n");
foreach(string s in vstup.Split(' ')) // Vypis cisla ve stringu s, oddeleno mezerou
{
try
{
int i = int.Parse(s);
Console.Write((char)i + " "); // Vypis znak podle ascii hodnoty a jednu mezeru, neoddeluj radek
}catch
{
continue; // Kdyz to neni cislo, ignoruj to a pokracuj dal
}
}
Console.ReadKey();
Console.Clear();
break;
case 't':
Console.Clear();
Console.WriteLine("Zadej text");
vstup = Console.ReadLine();
Console.WriteLine("\n");
foreach(char c in vstup)
{
Console.Write((int)c + " "); // Vypis ascii hodnotu znaku a jednu mezeru, neoddeluj radek
}
Console.ReadKey();
Console.Clear();
break;
}
}
Neformátovaný
Přidáno: 19.9.2016
Expirace: Neuvedeno