• 0

Is something wrong with Console Application in Visual Studio C# ?


Question

I've started working with console application for a while some of the programs that executed worked properly and gave the correct output, but some executed properly but no output was displayed in Debugger, here's one of of them

 class Duck : IComparable<Duck>
    {
        public int Size;
        public KindOfDuck Kind;

        public int CompareTo(Duck duckToCompare)
        {
            if (this.Size > duckToCompare.Size)
                return 1;
            else if (this.Size < duckToCompare.Size)
                return -1;
            else
                return 0;
        }
    }
    enum KindOfDuck
    {
        Mallard,
        Muscovy,
        Decoy,
    }
class Program
{
        public static void PrintDucks(List<Duck> ducks)
        {
            foreach (Duck duck in ducks)
                Console.WriteLine(duck.Size.ToString() + "-inch " + duck.Kind.ToString());
            Console.WriteLine("End of ducks!");
        }
        static void Main(string[] args)
        {

            List<Duck> ducks = new List<Duck>()
            {
                new Duck() {Kind = KindOfDuck.Mallard, Size = 17 },
                new Duck() {Kind = KindOfDuck.Muscovy, Size = 18 },
                new Duck() {Kind = KindOfDuck.Decoy, Size = 14 },
                new Duck() {Kind = KindOfDuck.Muscovy, Size = 11 },
                new Duck() {Kind = KindOfDuck.Mallard, Size = 14 },
                new Duck() {Kind = KindOfDuck.Decoy, Size = 13 },
            };
            ducks.Sort();
            Console.ReadKey();
        }
}

When i press the start button, under the output tab its shows symbols loaded, but in the Debug//ConsoleApplication.exe nothing seem to appear it's just blank,

Do i need to  include a  library in the program class so that output is displayed ?

2 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Elon Musk's robotaxi will have a human driver for 'safety' reasons by David Uzondu Image via Depositphotos.com A few days ago, we reported that Tesla was gearing up for its robotaxi launch, set to kick off in Austin, Texas, and now the details of the service are trickling out. Electrek says that some popular pro-Tesla influencers on X have gotten invitations to the launch. These invitations came with a list of rules, and the most glaring one was the presence of what Tesla called a "Safety Monitor" in the front passenger seat. This is basically a human supervising driver whose entire job is to watch the car and make sure it does not drive itself into a ditch. This might feel a little strange, especially given Musk's claims of "no driver" testing in the past. The safety monitor is one of the employees with access to buttons that can stop the car, much like the ones available to Waymo passengers in their fully autonomous rides. The service will operate within a geofenced area from 6 AM to 12 AM and will not run during bad weather. Other requirements include a credit card on file and an agreement that you will not be a jerk. Participants must also agree to a bunch of other rules, and one of the most interesting ones is that their access can be terminated if they share content on social media that shows the vehicle being misused. On top of that, they're not allowed to reverse engineer the technology in any way. At least the passenger gets a bit of a break. So, unlike the Tesla Full-Self Driving Beta, which requires the owner's constant attention, the supervising driver is expected to pay attention. At the same time, you, the passenger, can relax and enjoy the ride. According to Electrek's Fred Lambert, the robotaxi launch seems like an optics thing, designed to let Elon Musk say he met his June deadline for launching a robotaxi network.
    • I don't get why you care how thin your phone is. Most people slap a giant case on it anyway, so it doesn't mean much in the long run.
    • Yay it finally made it to openSUSE Tumbleweed. Installed on the rest of my PCs/laptops and also working just fine. Was also available before for KDE Neon and Fedora. And I hear Arch also already has it.
    • Yeah basically family safety is tied to your sons acc and your be the manager of it right and can see what they view and can control it. However open edge and you can actually signin to another account while on the windows account you are monitoring and bypass the restrictions. It was different to this on Windows 7 all the stuff was local not in cloud, so didn't matter if you signed out the browser. Chrome can usually still be installed even when blocked, my son used to use other acc in browser and download chrome and then use that freely and install apps and stuff as webapps. None of the tracking stuff would work. I originally ended up blocking downloads via group policy, microsoft store, winget, and loads of other stuff via group policy. But yeah as i said he just got to the point he reset the pc. I stopped that with bios password but he yanked the cmos battery (restores bios and removes password) and reinstalled windows. Other than physically locking the case away and watching him like a hawk its gameover now. It was kinda self inflicted, i did teach my son some cybersecurity stuff and i used to encourage him to try get past my blocking (so he learnt some skills for the future), he can actually lockpick interesting how you bring that up lol (another thing i got him into) I agree with the parenting thing locking stuff down is not the only solution.
  • Recent Achievements

    • Week One Done
      Helen Shafer earned a badge
      Week One Done
    • First Post
      emptyother earned a badge
      First Post
    • Week One Done
      Crunchy6 earned a badge
      Week One Done
    • One Month Later
      KynanSEIT earned a badge
      One Month Later
    • One Month Later
      gowtham07 earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      662
    2. 2
      ATLien_0
      269
    3. 3
      Michael Scrip
      223
    4. 4
      Steven P.
      167
    5. 5
      +FloatingFatMan
      162
  • Tell a friend

    Love Neowin? Tell a friend!