Finding Positon of characters

Reply

Join Date: Nov 2007
Posts: 3
Reputation: Awais Ahmad is an unknown quantity at this point 
Solved Threads: 0
Awais Ahmad Awais Ahmad is offline Offline
Newbie Poster

Finding Positon of characters

 
0
  #1
Dec 2nd, 2008
I want to writer a program in which i input an array?
let the array i entered is :
4
1
2
3

The prigram can take values and find the positions of the character in the array such that the smallest on 0 position and so on.
The result of the array will be if i start array from 0

1
2
3
0

that means it will find the position of the numbers in the array and display it on the screen
Onlt the position of the numbers is specifying and the position of the numbers.

Any one to solve it.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 538
Reputation: Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough 
Solved Threads: 86
Murtan Murtan is offline Offline
Posting Pro

Re: Finding Positon of characters

 
0
  #2
Dec 2nd, 2008
If the array entered was:
  1. 40
  2. 20
  3. 10
  4. 30
I think the output should be:
  1. 2
  2. 1
  3. 3
  4. 0

Does it look like I understood the what the program is supposed to do?

I will not just solve your problem. I will help YOU solve your problem.

If you're writing a program, it will need to do the following:
1) Accept the user input for the array
2) Generate the output array
3) Display the output array

Have you written anything yet?

If so, which parts have you addressed?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,142
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1434
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Finding Positon of characters

 
0
  #3
Dec 2nd, 2008
I don't get it. How do you go from "40 20 ..." to "2 1 3 0" ?
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 182
Reputation: mrboolf will become famous soon enough mrboolf will become famous soon enough 
Solved Threads: 18
mrboolf mrboolf is offline Offline
Junior Poster

Re: Finding Positon of characters

 
0
  #4
Dec 2nd, 2008
I think that the resulting array is the list of positions that the elements of the first array occupied before being sorted.
For example the min elements of the first array is 10 and it was in position 2, then we have 20 at position 1, 30 at position 3 and 40 at position 0, so (40, 20, 10, 30) -> (0, 1, 2, 3) and (10, 20, 30, 40) -> (2, 1, 3, 0)

Someone please correct me if I'm wrong.

EDIT: I didn't see the other thread - why do some people think so often that quantity necessarily means quality?
Last edited by mrboolf; Dec 2nd, 2008 at 1:21 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 538
Reputation: Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough 
Solved Threads: 86
Murtan Murtan is offline Offline
Posting Pro

Re: Finding Positon of characters

 
0
  #5
Dec 3rd, 2008
I was trying to understand what he wanted to accomplish so I restated the problem. It did appear to me that the output array was an index into the the original array, but I wanted the original poster to confirm my understanding.

(If there's another thread, I didn't see it either -- sigh)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC