Hello everyone!

I've learning C# and I've seen that the ToUpper and ToLower methods were not impleted so I've write 2 simple programas that do this.

What do you think about them?

P.D.: Magic is real......... unless declared integer.
P.D.D.: Para entender lo que es la recursividad, primero hay que entender lo que es la recursividad.
using System;

class tolower
{
        public static char func_tolower(char c)
        {
                int aux;

                aux = ((int)c);
                if (aux <= 90 && aux >= 65)
                {
                        aux = aux + 32;
                        c = ((char)aux);
                        return c;
                }
                else if (aux == 165)
                {
                        aux--;
                        c = ((char)aux);
                        return c;
                }
                return c;
        }

        public static void Main()
        {
                Console.Write ("Enter a character: ");

                string character = Console.ReadLine();

                Console.WriteLine("{0}", func_tolower(character[0]));
        }
}
using System;

class toupper
{
        public static char func_toupper(char c)
        {
                int aux;

                aux = ((int)c);
                if (aux <= 122 && aux >= 97)
                {
                        aux = aux - 32;
                        c = ((char)aux);
                        return c;
                }
                else if (aux == 164)
                {
                        aux++;
                        c = ((char)aux);
                        return c;
                }

                return c;
        }

        public static void Main()
        {
                Console.Write ("Enter a character: ");

                string character = Console.ReadLine();

                Console.WriteLine("{0}", func_toupper(character[0]));
        }
}

Reply via email to