Search:

Type: Posts; User: Norm

Search: Search took 0.08 seconds.

  1. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    You need to look at the code posted in post#19 and make sure it does what is needed to solve the problem.


    This line says that the variable that holds the second largest number is never assigned...
  2. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    Does the program work correctly now? If not please explain what the problems are.
  3. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    Where are they assigned a value? Where is the statement that starts with: max =
    or with: nextmax =
  4. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    What is the name of the variable you are talking about that has the value of 0?
    Where is that variable assigned a value (other than 0)?
  5. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    Is a value ever assigned to the variable that is printed as 0?
  6. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    If the variable definitions are inside the loop, then all previous saved data is lost every time the loop goes around. There isn't enough code posted to see what it does.

    Does the code compile...
  7. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    OK except for count being used twice (vs nxMcount).
    Now write down the logic needed to do that
    and then write the code for it.
  8. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    Do you need separate counters, one each for max and nextMax?

    Look at what variables are needed for the task. You seem to have a few extra that are not used or are mis-used.


    What about the...
  9. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    There needs to be more complicated logic used that uses multiple if statements and nested if statements.
    Pseudo code:
    initialize
    begin loop
    get number
    is number > max
    ... more logic here
    else...
  10. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    Use if statements to compare the various variables' values.

    The posted code needs proper formatting. Nested statements should be indented 3-4 spaces
  11. Replies
    21
    Views
    1,326

    Re: Homework help using max method

    Define two variables: largest and nextLargest and save the appropriate values in each as the values are read in and compared to what was found previously.
Results 1 to 11 of 11