Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB Question

Options
  • 26-11-2007 1:58pm
    #1
    Registered Users Posts: 130 ✭✭


    Hi im new to VB so sorry if this is ridiculously obvious or anything but im trying to make a program where the user enters 7 numbers and the program then adds up the 6 highest numbers. I have an idea of how to do it but my way would take huge amounts of code so i was wondering if there was any quicker way of doing it.
    ty


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Whats your way?


  • Closed Accounts Posts: 345 ✭✭FindingNemo


    mrac wrote: »
    Hi im new to VB so sorry if this is ridiculously obvious or anything but im trying to make a program where the user enters 7 numbers and the program then adds up the 6 highest numbers. I have an idea of how to do it but my way would take huge amounts of code so i was wondering if there was any quicker way of doing it.
    ty

    look up ARRAYS


  • Registered Users Posts: 130 ✭✭mrac


    My way was to just use a hell of alot of if statments, how would do do it with arrays ? (sorry i know nothing about arrays)


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Can you post a rough example of the code you would use to achieve your ideas.

    If you check the charter, we ask that you provide some example of what you've done. One of us giving you the answer won't help anyone :)


  • Registered Users Posts: 901 ✭✭✭EL_Loco


    actually you can do it without arrays. you just need to track the lowest number inputted and take it away from the grand total at the end.

    now, there's the pseudo code, go VBorise it ;)


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Let the user input the numbers, and each time they do add the number to a total (and keep a store of this) and check to see if it the smallest number entered, to date, and store it. Then at the end subtract what was the smallest number from your total.

    Two variables, one for-next loop and one conditional. About six lines of code in all.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    EL_Loco wrote: »
    actually you can do it without arrays. you just need to track the lowest number inputted and take it away from the grand total at the end.
    Damn - should have read the thread in full. Beat me to it.


  • Registered Users Posts: 130 ✭✭mrac


    wOO I figured it out :P thaks for all your help.


Advertisement