Create the logic for a program that prompts a user for three
numbers and stores them in an array. Pass the array to a
method that reverses the order of the numbers. Display the
reversed numbers in the main program

## All 9 Replies

As has been stated multiple times in other questions such as this:
Post what you have so far, no one is going to do your homework for you. Instead, we will help you when you have problems, but not write it all for you.

After all, how else will you learn? :)

yahh! make your own homework... don't depend on others..
study hard...

To be a little bit more complete than plenty.groover, here's DW's member rules, on which you sign up over registration on this site:

Do provide evidence of having done some work yourself if posting questions from school or work assignments.

Thanks for the important reminder Lucaci! :)

I wasnt asking you to do it for me i ask for help

This is what i have so far im new to this site

``````Declarationns
num size = 2
num input array [SIZE
num count = 0
num comps =2
while count < 3
input array [size] where [x] = count
count = count + 1
endwhile
sort()
y =0
while y < COMPS
x =0
while  x <  comps
if input array [x] > input array [x + 1] then
swap()
endif
x = x + 1
endwhile
return
temp = input array [x +1]
input array [x + 1] = input array[x]
input array [x] = temp
``````

What do you have so far?

Create the logic for a program that prompts a user for three
numbers and stores them in an array.

You need an array of size 3 and a for loop to do this

Pass the array to a method that reverses the order of the numbers.

You will need to write a function that takes the array as parameters for this. Then in the function you need to swap the first and last element to reverse it since it is only 3 elements.

Display the reversed numbers in the main program

Again you will need a for loop to go through the array and print out the elements.

This is what i have so far im new to this site

This doe not appear to be C++. Do you have any C++ for this logic? If so, you should post that with some explanation as to what goes wrong when you try to build & run it.

``````int array[3],i;
cout <<"Enter three number into array\n";
for(i=0;i<2;i++)
{
cin>>array[i];

}

cout <<"Reverse number is\n";
for(i=2;i>0;i--)
{
cout<<array[i]<<"\t"<<endl;
}

according to my point of view ..may or may not be right
``````
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.