Hello all, I am trying to design the logic for a program that allows a user to enter 10 numbers, then displays them in the reverse order of their entry. This is in pseudocode.

Thanks for your suggestions!

Are you familiar with stacks?
A stack is a data structure that is accessed only by it's last element.
The simplest stack is made with an array and a "top" index.
When you start, you can set the top index to zero.
To add data to the stack, you "push" it on.
To push, you simply do this:

function push(data)
    if top>stack.size
        stack[top]=data
        top=top+1
    end if
end function

To get data from a stack, you pop it.

function pop()
    if top>0
        top=top-1
        return stack[top]
    end if
end function

So what you do is push ten values, then pop them back. Try it.

Store them in an array and when done output the array starting from the last input.

For pseudocode you dont have to write in any specific programming language. Just write for example :

i = lastitem...firstitem

!Comment
...

Declare an Array with the size of 10
Declare a variable, Var1

!A loop for the input

For Var1=1,10,1 !(For Start_Value,End_Value,Step)

...Receive the Input and store it in the Array, in the position of the Var1

End For

For Var1=10,1,-1 !(Invert the order...)

...Print the values previously stored in the array, in the position of the Var1

End For

!And that's it!

_____________

In Fortran it would look like this (not 100% accurate, but if u know Fortran u'll get the point, xD):

Real :: Var1, Array(10)

For Var1=1,10,1
    Read*, Array(Var1)
    End For
For Var1=10,1,-1
    Print*, Array(Var1)
    End For

Hope it Helps
VLV

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.