You really need to read some books on C++ (from the basics). An executable has only one entry point (the main function in your case, to make it simple). Separating your code into different cpp files is useful only for structuring your code properly, but it doesn't mean that you have 3 "programs". You still have only one main. If you want to execute code from the different files, you need to call these functions from within your main function.
What about if there are two identical numbers in different positions? Is that possible?
Anyways... one possibility (hard coded) could be... you go through the array evaluating the actual number with a maximum that you update when you find that the actual number is higher than this max. If you find it, you can save the value of "i" temporary and continue evaluating. When the array is checked to the end you can know where the highest number was with your temp_i, then put a very low (or negative) number that is not going to disturb you on the next evaluation and start over again.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
Create another array where each element stores (v, i), where value is the value in the input array and i is its index. Then you sort this array on v. You can store v and i in a structure and then use qSort for sorting.
the normal approach to sort an array value without moving its content is this:
- create an index array, initialized to 0...N-1
- implement whatever sort algorithm you like on that array, except, rather than comparing index[i] and index[j], compare value[index[i]] and value[index[j]] and move the content of index around as a result of the sorting steps.
another thing.. you've mentioned something about initializing the array from 0->N-1, ive done that while i know what size my array is.
what if the size is unknown N, how can i initialize it to be from 0 to N-1? should i make another loop to initialize it or there is some other way?
I want to fully draw combobox control by myself, not only the list items. I searched but only found some demos about how to custom draw its subitems. But I really want to draw the edit, arrow button and listbox of the combobox completely. So, is there any example or idea?
Are you suppose to collect all the colors uses by an image & put them into different segment accordingly?
If so, then open image into binary format & create four matrix of R,G,B & O (offset values) considering each of them as a segment. Put each RGB values into corresponding martix. Thats all I guess.
I am developing one application that create Internet Shortcut and it is working fine. But in some system it fails to save and Send error message "Access Denied". How to resolve this issue??
Thanks in advance.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN