c# homework

Discussion in 'Programming General' started by Do It Right, May 3, 2013.

c# homework
  1. Unread #1 - May 3, 2013 at 8:56 AM
  2. Do It Right
    Joined:
    Feb 12, 2012
    Posts:
    416
    Referrals:
    0
    Sythe Gold:
    0

    Do It Right Forum Addict

    c# homework

    hey i was wondering if anyone could help em with my homework for C# hereare the directions


    1. The form includes a menubar and a list box.
    2. The menubar includes a file menu item which contains options for Open and Exit
    3. The menubar includes a Calculate menu item which contains options for Max, Min, and Average
    4. When the File/Open command is used the program prompts the user for a file using the common dialog Open
    File dialog box.
    5. Open a file containing a series of numbers such as:
    456.66
    234.44
    678.55
    234.55
    6. Display the values in the list box.
    7. When the user choose Calculate/Max display the largest value in the list.
    8. When the user chooses Calculate/Min display the smallest value in the list.
    9. When the user chooses Calculate/Average displays the average of these numbers.
    10. When the user choose File/Exit the program exits.



    I have made the form and got the exit to work and i was wondering how i am going to scan a given file and go through all the numbers in it and find the biggest number and then find the lowest number and then find the average number.

    any help is appreciated thanks.
     
  3. Unread #2 - May 20, 2013 at 3:26 AM
  4. Game
    Joined:
    May 20, 2013
    Posts:
    352
    Referrals:
    99
    Sythe Gold:
    495

    Game Some men just want to watch the world burn.
    Banned

    c# homework

    You could do this more efficiently but for the sake of I/O homework here...

    Code:
            double[] numbers = File.ReadLines("c:\\values.txt");
    
            foreach (double d in lines)
            {
                listBox1.items.add(new ListItem(d.ToString());
            }
    
    I've just written that from scratch so it probably needs playing around with first. Good luck. :p
     
< Need help with a simple Java code | I heard about Appstore Bot Farming >

Users viewing this thread
1 guest


 
 
Adblock breaks this site