المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Can Anyone Solve this for me



C# Programming
03-22-2012, 11:42 AM
Q5: Write a C# program that inputs three numbers and then prints them out in ascending order.
The valid range for each number is [0, 100]. Your program should have two user-defined
methods: the first is to input and validate the number (it is called three times) and the second
is to determine the proper order of the numbers. The methods headers should resemble:
public static int GetNumber()
- prompts the user for an integer and ensures that it is between 0 and 100 (use a dowhile
loop)
public static void OrderNumbers(ref int num1, ref int num2, ref int num3)
- upon entry num1, num2, num3 contain the values input by the user
- upon completion num1 will hold smallest value, num2 will hold the second
smallest value, and num3 will hold the largest value (use a selection statement).
The Main method will output the results (after the method OrderNumbers has been called).