Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
like i have 3 arrays and in the 1st array i have 1 in the 2nd i have 2 and in the 3rd i have 3 and i want to copy the values in each array into another array but in the 1st element in the 1st array it should have 3 and in the 2nd 2 and in the 3rd 1

What I have tried:

i have finished the 1st part of the question which is asking the user to enter the number of the elements in the array and asking him again to enter the numbers in each element in the array
Posted
Updated 2-Mar-18 3:01am

Start with a piece of paper and a pen or pencil. Draw each array as a set of boxes, and add the numbers in the right places. Now see what needs to be done to get from there to the answer, in logical steps. Write each step as you figure it out, updating the diagrams as you go. When you have finished you just need to convert the pseudocode you have written into whatever language you plan to use for your program.
 
Share this answer
 
Take a piece of paper and 3 tokens.
Draw 3 squares, put 1 token in each square.
this is your starting point
What you want to do is a rotation
Take 1 token, move it outside of the squares
Now 1 square is empty, you can move 1 token from another square, repeat
And finally, move the token aside in the free square.

this is how your program will work, simply the 'aside' thing is another variable.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900