Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Visual Logic Basics, needed


  • Please log in to reply

#1
Phoenixuncaged

Phoenixuncaged

    New Member

  • Member
  • Pip
  • 2 posts
I am not looking for someone to do my work, I just feel like I somehow missed a part of my book, and need someone to point me in the right direction.

I am suppose to create a program that I input however many positive numbers in and after a sentinal -1 is entered the program then choices what the largest input was and displays it.
I know how to count, and use sum to accumulate.
I have no clue how to make it retain the inputs and then pick the largest.. VL Largest.JPG

Thank you
  • 0

Advertisements


#2
TheBigHelper

TheBigHelper

    Member

  • Member
  • PipPipPip
  • 546 posts
What you could do is input all the values into an array. Have a different variable to store the largest number, say largest_number. Once you have all the numbers ready to be checked, assign the value of the largest_number equal to the first element in the array. Now run this through a loop and compare the value of the each element in the array to largest_number. If condition satisfies, change the value of largest_number accordingly. And finally simply output it. Here is how it would sorta look like in java:


int largest_number=numberArray[0];
for(int x=0; x<numberArray.length; x++){
if(numberArray[x]>largest_number){
largest_number = numberArray[x];

  • 0

#3
Phoenixuncaged

Phoenixuncaged

    New Member

  • Topic Starter
  • Member
  • Pip
  • 2 posts
Arrays are chapter 5 and this is chapter 3 homework, I am so confused, I have emailed my teacher twice about it, and he hasn't even responded.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP