Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Number Assigner

CroissantManCroissantMan Member
edited August 2020 in Programming

I just created a program that a teacher may use to assign numbers to students based on the first letter of their name. I'm a beginner, so I tried to just make something simple.

using System;

using System.Collections.Generic;


namespace Number Assigner

{

    class Program

    {

        static void Main(string[] args)

        {

            // Console Customization

            Console.ForegroundColor = ConsoleColor.DarkRed;

            Console.Title = "Number Assigner";


            Console.Write("Number of children in your class: ");

            int childCount = Convert.ToInt32(Console.ReadLine());


            string[] children = new string[childCount];


            Console.WriteLine("What are their names?");


            for (int i = 0; i < children.Length; i++)

            {

                children[i] = Convert.ToString(Console.ReadLine());

            }


            Array.Sort(children);

            Console.WriteLine("Here are your student's names and newly assigned numbers.");


            for (int i = 0; i < children.Length; i++)

            {

                int studentNumber = i + 1;


                Console.WriteLine(studentNumber + ". " + children[i]);

            }


            Console.WriteLine("Thank you for using the number assigner.");


            // User input to close

            Console.ReadKey();

        }

    }

}

The thing is, this is a very basic program and anyone who has watched Brackeys' C# tutorials would know how to make this. So, feel free to leave a suggestion to make this more professional.


Edit: I should mention this is sort of just my take on the programming challenge at the end of C# tutorial #5 - Arrays. I just added some extra things.

Answers

Sign In or Register to comment.