while loop question

Fatima 21 Reputation points
2021-02-24T19:57:45.623+00:00

How can I solve a question that asks: Write a program in while loop that receives an average of students and their names. The program stops upon receiving a star at the names or a negative number at the average. The program prints the rate of the highest student in c#

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,650 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Laude 85,726 Reputation points
    2021-02-24T21:04:57.427+00:00

    Hi @Fatima ,

    Please correct me if I am wrong, but it sounds like this is an academic task/homework, unfortunately we cannot do people's academic tasks/homework for you.
    If you have some code for your program that you are having difficulties with, then someone may be able to give you some advise/help, but we cannot write programs/code from scratch for others.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Best regards,
    Leon


1 additional answer

Sort by: Most helpful
  1. Timon Yang-MSFT 9,586 Reputation points
    2021-02-26T06:25:06.117+00:00

    I think you can use Dictionary<TKey,TValue> Class to solve your problem.

    Put each set of input data into the Dictionary in each loop, and then call the dictionary orderby method and get the first one.

    In addition, there are two identical pieces of code in your code, which is unnecessary.

    Try to use do-while loop instead of while loop.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments