This is probably a really stupid thing to ask considering the development I'm doing (effectivly creating a virus scanner), but how do I link classes/cpp files?
I have 3 applications/sections that I can compile/combine with a makefile, that's fine, but I need them to run 1, 2, 3 once the output from the makefile is done.
Currently the only section to actually run is whichever I have "main" in and obviously if I put that into all three, they won't compile as one.
I've been looking all over the place at all sorts, header files and such, but there is no mention of how to actually do this although I'm sure it must be possible. I'm used to being able to do this in Java and I'm sure I've seen C++ applications do it, but not worked out how.
I have 3x .cpp files which are combined into one using a makefile:
scanner.out will run, but only whichever .cpp has "main()" in it, so the other two are defunct but are included within scanner.out. If I compile the three files separately I end up with three programs, but I need them to work together as a single application.
I'm doing all my work on Linux using vi to edit the files, but I assume what I want to do is generic between systems.
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
Last Visit: 31-Dec-99 18:00 Last Update: 30-Sep-23 13:00