My first project

Hi guys :slight_smile:
I’ve started learning C# since 25/4/2020
i tried to make a program that tells your if today is your birthday or not
if yes : the program will tell you Happy birthday
if not: The Program will tell you how many months and days are left

tell me your feedback guys and what should i do to improve my coding skills:

            //________________________________
            //MADE BY: SHERKO AZAD SAMO
            //PROJECT NAME: BIRTH DAY DETECTOR
            //________________________________



            //Take Info----------------------------------------------------------------
            Console.WriteLine("Welcome To Birthday Program \n What's Your Name?");
            string name = Console.ReadLine();

            Console.WriteLine($"Ok MR.{name}... Nice To meet You ^-^ ....to start the program, please enter the current month as a number (up to 12) (1 for Jan , 2 for Feb,,,,,etc):");
            int currentMonth = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine($"Very Good MR.{name}....please enter the current day as a number:");
            int currentDay = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine($"Now Enter Your Birth month as a number(up to 12):");
            int birthMonth = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine($"Now Enter Your Birth Day as a number:");
            int birthDay = Convert.ToInt32(Console.ReadLine());

            //BIRTHDAY------------------------------------------------------------------
            if ((currentMonth == birthMonth) && (currentDay == birthDay))
            {
                Console.WriteLine("HAAAAAAAAAAAAAPPPPPPPYYY BIRTHDAAAAAAAAY BROOOOOOOO!");
            }

            //1-------------------------------------------------------------------------
            else if ((currentMonth < birthMonth)&&(currentDay < birthDay))
            {
                int M = birthMonth - currentMonth - 1;

                int D = birthDay - currentDay;

                Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
            }
            //2-------------------------------------------------------------------------
            else if ((currentMonth < birthMonth) && (currentDay == birthDay))
            {
                int M = birthMonth - currentMonth;

                int D = 0;

                Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
            }
            //3-------------------------------------------------------------------------
            else if ((currentMonth < birthMonth) && (currentDay > birthDay))
            {
                int M = birthMonth - currentMonth - 1;

                int D = birthDay - currentDay + 30;

                Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
            }
            //4-------------------------------------------------------------------------
            else if ((currentMonth > birthMonth) && (currentDay < birthDay))
            {
                int M = birthMonth - currentMonth + 12 - 1;

                int D = birthDay - currentDay;

                Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
            }
            //5-------------------------------------------------------------------------
            else if ((currentMonth > birthMonth) && (currentDay == birthDay))
            {
                int M = birthMonth - currentMonth + 12;

                int D = 0;

                Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
            }
            //6-------------------------------------------------------------------------
            else if ((currentMonth > birthMonth) && (currentDay > birthDay))
            {
                int M = birthMonth - currentMonth + 12 - 1;

                int D = birthDay - currentDay + 30;

                Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
            }
            //7-------------------------------------------------------------------------
            else if ((currentMonth == birthMonth) && (currentDay < birthDay))
            {
                int M = 0;

                int D = birthDay - currentDay;

                Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
            }
            //8-------------------------------------------------------------------------
            else if ((currentMonth == birthMonth) && (currentDay > birthDay))
            {
                int M = 11;

                int D = birthDay - currentDay + 30;

                Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
            }
            //--------------------------------------------------------------------------
            else
            {
                Console.WriteLine("ERROR");
            }
2 Likes

Hi, welcome to the forum!

Not bad. :slight_smile:

Have you considered, instead of asking the user to tell your program what the date is, using DateTime to get this automatically? (You might find that there’s other methods available via DateTime as well to simplify some of your calculations.)

Thank you for your feedback!
actually I don’t know how to use DateTime because I am learning C# recently :sweat_smile:
In addition, C# courses did’t mention to DateTime and how to use it :sweat_smile:
Thank you for this link i will learn about this structure and use it in my programmes soon :heart_eyes:

That’s why I gave you a link to the documentation for it. :slight_smile: That link has information about all the methods you can use within DateTime to streamline your program a bit. :slight_smile:

I don’t think there’s a course out there anywhere which walks you though the entirety of a language. A lot of learning in programming is actually wondering how to do something, and looking it up in the documentation. :slight_smile: