| akki199421 (6) | |
| I have to write a program to count the occurrence of each element in array??plz hlp me? | |
|
|
|
| jumper007 (361) | |
| Well, what's your first attempt ? Any idea ? No one will do it for you. | |
|
|
|
| vlad from moscow (3662) | |||
|
You can use standard container std::map for this purpose. For example (without testing)
| |||
|
Last edited on
|
|||
| SamuelAdams (321) | |
|
Write down the process then code it, show us what you can do. 1 idea First you need to know the size of the array create a while loop inside a for loop see if array[x] matches array [y] then subtract 1 from your total because array[0] should always match array[0]. | |
|
Last edited on
|
|