Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
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