Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8224367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:02:51+00:00 2026-06-07T15:02:51+00:00

im new to c# programing and i was doing an console application for a

  • 0

im new to c# programing and i was doing an console application for a friend who was creating a 3 question test. i need to get the name of the top 5 users and display their grade, but i don’t know what to do. could you please help me thanks. This are the codes:

string Name, yn;
int points = 0;
 do{
        Console.WriteLine("Please enter your fullname here:");
        Name = Console.ReadLine();
        Console.WriteLine(" ");

        Console.WriteLine("Hello " + Name + " Welcome to this simple test.");
        Console.WriteLine(" ");

        Console.WriteLine("1) What is 5 + 6?");
        Console.WriteLine("   a)10");
        Console.WriteLine("   b)30");
        Console.WriteLine("   c)11");
        Console.Write("Answer: ");
        string QAns1 = "C";
        string MyAns1 = Console.ReadLine().ToUpper();
        Console.Clear();
          if (MyAns1 == QAns1)
                {
                    Point++;
                }

        Console.WriteLine("2) What is the first letter of Apple?");
        Console.WriteLine("   a)A");
        Console.WriteLine("   b)c");
        Console.WriteLine("   c)a");
        Console.Write("Answer: ");
        string QAns2 = "A";
        string MyAns2 = Console.ReadLine().ToUpper();
        Console.Clear();
          if (MyAns2 == QAns2)
                {
                    Point++;
                }
       Console.WriteLine("3) What is the plural word of tooth?");
        Console.WriteLine("   a)tentacles");
        Console.WriteLine("   b)Teeth");
        Console.WriteLine("   c)tooths");
        Console.Write("Answer: ");
        string QAns3 = "B";
        string MyAns3 = Console.ReadLine().ToUpper();
        Console.Clear();
          if (MyAns3 == QAns3)
                {
                    Point++;
                }

        Console.WriteLine(" Mr. " + Name + " your final score is " + Point + "/10 ");
        Console.WriteLine(" Do you want to try again? ");
        yn = Console.ReadLine().ToUpper();
  }while (yn== "Y");
     Console.WriteLine("Thank you for using our program.");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:02:53+00:00Added an answer on June 7, 2026 at 3:02 pm

    There are tons of ways to do this, but to get you started, I’ve added some parts to your code that you can play with.

    After each game is finished, you can add the score and name to a collection.

    The collctions of scores with the persons name as a key:

    var playedGames = new Dictionary<string, int>();

    Then when each game is finished, you can add the score to the collection like this:

    playedGames.Add(Name, Point);

    Then, when no more games are going to be played, you can order the collection by the top scorers and take out 5 of these like this:

    var topScorers = playedGames.OrderByDescending(x => x.Value).Take(5);

    Then you can print out these 5 top players:

    foreach (var topScorer in topScorers)
    {
        Console.WriteLine("Congratulations {0} you made the highscore with {1}", 
            topScorer.Key, topScorer.Value);
    }
    

    Here’s a complete sample on how you can do it:

    string Name, yn;
    int points = 0;
    var playedGames = new Dictionary<string, int>();
    do
    {
        var Point = 0;
        Console.WriteLine("Please enter your fullname here:");
        Name = Console.ReadLine();
        Console.WriteLine(" ");
    
        Console.WriteLine("Hello " + Name + " Welcome to this simple test.");
        Console.WriteLine(" ");
    
        Console.WriteLine("1) What is 5 + 6?");
        Console.WriteLine("   a)10");
        Console.WriteLine("   b)30");
        Console.WriteLine("   c)11");
        Console.Write("Answer: ");
        string QAns1 = "C";
        string MyAns1 = Console.ReadLine().ToUpper();
        Console.Clear();
        if (MyAns1 == QAns1)
        {
            Point++;
        }
    
        Console.WriteLine("2) What is the first letter of Apple?");
        Console.WriteLine("   a)A");
        Console.WriteLine("   b)c");
        Console.WriteLine("   c)a");
        Console.Write("Answer: ");
        string QAns2 = "A";
        string MyAns2 = Console.ReadLine().ToUpper();
        Console.Clear();
        if (MyAns2 == QAns2)
        {
            Point++;
        }
        Console.WriteLine("3) What is the plural word of tooth?");
        Console.WriteLine("   a)tentacles");
        Console.WriteLine("   b)Teeth");
        Console.WriteLine("   c)tooths");
        Console.Write("Answer: ");
        string QAns3 = "B";
        string MyAns3 = Console.ReadLine().ToUpper();
        Console.Clear();
        if (MyAns3 == QAns3)
        {
            Point++;
        }
    
        playedGames.Add(Name, Point);
        Console.WriteLine(" Mr. " + Name + " your final score is " + Point + "/10 ");
        Console.WriteLine(" Do you want to try again? ");
        yn = Console.ReadLine().ToUpper();
    } while (yn == "Y");
    
    var topScorers = playedGames.OrderByDescending(x => x.Value).Take(5);
    
    foreach (var topScorer in topScorers)
    {
        Console.WriteLine("Congratulations {0} you made the highscore with {1} in score!",
            topScorer.Key, topScorer.Value);
    }
    Console.WriteLine("Thank you for using our program.");
    
    Console.ReadLine();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing my first web app (not new to programing) and I have a
I'm kinda new to programming and need help doing a recursive method.I have a
I'm very much new to programming and have been doing fairly well so far.
I'm fairly new to VB.NET, and I've mainly been doing ASP programming up 'til
i got a new programing book (multicore programming by cameron hughes, tracey hughes). so
I am new to programing and I have some difficulties getting AlertDialog working. I
Hi i am almost new in programing. I am faced with an error that
(I'm a mac user) I'm new at this whole programing thing. its been explained
What is the real benefit of creating a new programming language? It is highly
I am very new to programming, so I apologize if this question seems absurdly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.