1,118 Posted Topics
Re: Use the [B]FMUL[/B] opcode. See [b]80x87 Instruction Set[/b] [URL="http://www.deec.uc.pt/~jlobo/tc/opcode_f.html"]HTML[/URL] [URL="http://home.zcu.cz/~dudacek/SOJ/manualy/80x87set.pdf"]PDF[/URL] Hope this helps. | |
Re: This is the C++ forum. Are you sure you mean C functions and not C++? | |
Re: If all you want is teletype output (like you get on the console, without any fancy graphics or fonts or etc) you can open the PRN or LPT1 device: [code=C++] #include <fstream> #include <iostream> using namespace std; int main() { ofstream printer( "prn" ); if (!printer) { cout << "fooey!\n"; … | |
Re: If you are looking to port Win32 API code to Linux, take a look at [URL="http://www.winehq.org/"]Wine[/URL]. | |
Re: [URL="http://www.cplusplus.com/forum/unices/2047/"]Here's my response to a similar question (on another forum)[/URL]. Hope this helps. | |
Re: I've never used Dev-C++, but it should have a Windows MediaPlayer component that you can drop on your application, and use it to play the MP3. You can also google "msdn media control interface" for the APIs you can use to manipulate media devices on Windows. Good luck. | |
Re: You'll need to call [b]Randomize[/b] at the beginning of your program, and use [b]Random[/b] to generate each number. [inlinecode]number := random( 45 ) +1;[/inlinecode] generate random number in 1..45 You'll also have to decide how to store each lotto sequence. For example, a 6/45 sequence might be: [code=Pascal] type LottoNumber … | |
Re: This is an issue with DOS BOX, not C. I recommend you visit the DOS BOX forums. [url]http://vogons.zetafleet.com/index.php?c=7[/url] Good luck! | |
Re: You'll have to look through the documentation to see what you can do. Besides lines and various shapes and bitblts and text there isn't much more BGI can do. It is a [i]really[/i] old architecture, and DOS-centric. I would actually suggest playing around with [URL="http://www.libsdl.org/"]SDL[/URL]. It is more powerful and … | |
Re: I'm not sure I understand what you are trying to do in your code (it is mixing siblings and children, which would be some kind of inversion...) But if what you are trying to do is convert this: [code] +---+ | 0 |--X +---+ | V +---+ +---+ +---+ | … | |
Re: Why not use the STL? Is this schoolwork? Either way, I still don't understand what you are trying to do with that function pointer. But the best place to get your head around it is to take a read through [URL="http://www.newty.de/fpt/"]The Function Pointer Tutorials[/URL]. Hope this helps. | |
Re: Whenever you hear people raging a lot about stuff like that you can almost always just ignore it. The overhead of a virtual function call is so small that you have [i]really[/i] got to be pushing the limits for it to make a difference. Hmm... here's a link to the … | |
Re: I've seen far worse code... (and I've always gotten myself into a lot of trouble by 'complaining' about it --even when it was obvious that it was costing the company thousands of dollars in delays and workarounds). It might be worth suggesting to the prof in charge that he consider … | |
Re: Hey, this game is cooler than dirt! :) I am not sure what your requirements are -- are you supposed to make your program solve the puzzle? or are you just supposed to notice when the user has successfully solved the puzzle? You have, BTW, a conflict in your data. … | |
Re: You need to turn the computer off and think about how to solve the problem before you confuse yourself with any more code. There is too much of it. Here are some hints. [list] [*]A 3x3 grid can be solved by placing the numbers 1 through 9 in it [i]in … ![]() | |
Re: That macro invites death without warning. If you want to swap something, #include <algorithm> and use [B]std::swap[/B](). @[b]cecyl[/b] Generic algorithms will work just fine, but if you know something about the probable distribution of your data then you can reduce sort time considerably. If you know that you have a … | |
Re: It sounds like you are out of luck. If you have been absent for valid reasons (medical emergency, death of immediate family member, etc) many Universities will require the professor to give you reasonable accommodations to make-up the work which you have missed. I would add that your assignment is … | |
Re: The [b]char[/b] datatype is not guaranteed to be stored in a single byte, either. I would also like to expand somewhat on [B]Ed[/B]'s response. Typically you don't want to [i]directly[/i] print your data, but you want to [i]transform[/i] it when you read and write it. That's what [b]cin[/b] and [b]cout[/b] … | |
Re: Wrong forum. This is the C++ forum. Binary I/O is straight-forward, but you need to be aware of certain caveats. You never list the types of [B]result[/B] and [B]rest[/B], but if they are different types then you are playing with fire. You should also be aware of endianness issues and … | |
Re: The problem is that you are trying to multiply [I]strings[/I], which you cannot do. Remember, the [I]string[/I] '12' is different from the [I]number[/I] 12. So, you must first convert the PARADATA strings into numbers, multiply them together, then convert the resulting number back to a string, which you can print. … | |
Re: The [B]swap[/B] function is provided for backwards compatibility only. It cannot handle [B]integer[/B]/[B]cardinal[/B] sized types. It can only handle [B]smallint[/B]/[B]word[/B] (16-bit) values. You might want to write your own versions of swap. | |
Re: Usually a TSR will override one of the user interrupts (like $60) so that you can communicate with it (and, for example, tell it to stop). If I remember correctly, once you load a TSR you cannot unload it, but you can disconnect it by restoring the interrupt vectors to … | |
Re: Your [B]Vector3[/B] is missing the appropriate copy constructor. A good rule of thumb is if you use any one of copy constructor, assignment operator, or virtual destructor, then you need all three. (Not always, but usually.) Hope this helps. | |
Re: Are you using [B]Delphi[/B] or [B]Pascal[/B]? (It makes a difference.) All binary trees are just a fancy form of linked-list, so there is no reason why you can't include a string in your node record. In Delphi: [code=Delphi] type pNode = ^tNode; tNode = record word: string; left, right: pNode … | |
Re: Here's a link all about it: [URL="http://www.daniweb.com/forums/thread103675.html"]Tutorial: Handling Dates and Time in Delphi[/URL]. For D5 all the date-time stuff is in the [B]System[/B] unit. The [B]DateUtils[/B] unit first appeared in D6. While there are some extra-friendly functions there, it isn't anything you really can't do without. You can either write … | |
Re: I'm really not sure I understand the question, but as it has been five days I figure I'll give it a shot... :-/ If it is just a matter of mixing whole games and half games, convert to the lowest common denominator: half games. So for every whole game from … | |
Re: Google "linked list". I presume each node represents a single atom? | |
Re: Heh, that was an interesting thread... Yes, there is a simple, one-shot way to do it using the STL, but it is fairly advanced stuff (though I don't know why) :twisted: Here's a little program to demonstrate it. [code=C++] #include <algorithm> // for copy() #include <iostream> // cin, cout #include … | |
Re: Two things: 1) [b]char[/b] is not the same as [b]char*[/b]. The first is a single character. The second is an address to one or more characters (like an array). Your function should take the second as argument. 2) The function prototype lists an argument, but the function itself never names … | |
Re: You'll want to play with [URL="http://www.masm32.com/"]MASM32[/URL]. It has everything you need. Good luck! | |
Re: Eh, I understand. You solved it. Your makefile looks fine to me. I usually write my makefiles by hand as well. However, for large projects people will tend to some sort of program like [URL="http://www.gnu.org/software/automake/"]automake[/URL] or [URL="http://www.scons.org/"]scons[/URL] or some other like tool to manage all the dependencies in your project … | |
Re: I'm not sure I understand your question. OpenGL programs only have one screen/view. Do you mean that you want to draw to someplace other than the OGL window? | |
Re: I disagree. I think that [b]getline[/b]() is one of those under-valued little functions that make simple parsing like this a breeze. But like [B]VD[/B] said, you must use it on a stream. You actually almost have it already. [code=C++] vector <int> parse_date( string date ) { vector <int> result; stringstream … | |
Re: I don't want to obnoxiously barge-in to this thread, but the STL allows you to do a lot of this stuff automatically. [code=C++] #include <algorithm> #include <iostream> #include <iterator> #include <limits> #include <deque> #include <string> using namespace std; int main() { deque <double> numbers; // Use the STL to read … | |
Re: Do you mean you have something like this: [code=C++] class Foo { private: Baz* baz; // <-- This gets shared between instances. // It will cause problems... (See the destructor!) public: Foo(): baz( new Baz ) { } Foo( const Foo& foo ): baz( foo.baz ) { } ~Foo() { … | |
Re: (Sorry, I've got a splitting headache so I haven't really looked at your code...) For a CSV file you know that the headers are there. If you load all lines into the vector then it is easy to delete them before saving again. (While a vector works fine for this, … | |
Re: While the libraries are non-portable, don't worry too much about using _kbhit() or some other like function. If you [i]do[/i] need to port someday, it is trivial to implement it in terms of the new platform. While [b]jephthah[/b] is correct that you are better off just learning to do it … | |
Re: I think your professor means he wants you to search the array with 100 randomly generated numbers (a new random number to find for each search). The only meaning I can get out of sequential search is just what you'd expect an unordered search to look like: does elt 0 … | |
Re: For all those graphic characters you are completely at the mercy of the terminfo database, which is often enough incomplete in that respect. I typically just set the graphic characters to a nice combination of minus, pipe, and plus (-, |, +) in my initialization code. | |
Re: I've not had that problem. I also don't see how you can get it when I look through Variants.pas. Are you sure the file isn't damaged in some way? (Like missing an [b]end[/b] or somesuch?) | |
Re: Depending on how the data is packed. If it is packed (MSB...LSB) ARGB then [code=C++] int alpha = (color >> (3 * 8)) & 0xFF; int red = (color >> (2 * 8)) & 0xFF; int green = (color >> (1 * 8)) & 0xFF; int blue = (color >> … | |
Re: This is the reason I think making typedefs to pointers is a bad idea... It looks like you did the right thing, but the compiler is saying that the [B]xmlDoc[/B] class does not publish a method named [b]leerEntrada[/b](). It looks like you are including the correct files (since the compiler … | |
Re: I'm not sure I understand your requirements. Is this a homework assignment to use lists? Or is this work-work? Do you have an existing database or do you have to design it? How does the database update (synchronize with warehouse stock)? What do lists have to do with it? Is … | |
Re: You need to write the comparitor. [code=C++] #include <sstream> #include <string> struct mysort { bool operator () ( const std::string& a, const std::string& b ) { std::stringstream as( a ); std::stringstream bs( b ); double ad, bd; as >> ad; bs >> bd; return ad < bd; } }; [/code] … | |
Re: [B]DialogA[/B] is in a separate exe than [B]DialogB[/B]? You will need to play with the STARTUPINFO structure when you call [B]CreateProcess[/B](). Either that or just set both dialogs to center themselves on the screen or on their parent when they are used. Hope this helps. | |
Re: The best way to deal with console text alignment issues is to get out a piece of graph paper and a stylus and draw what you want it to look like. Then you can count things out so that they always match. As for the CSV stuff, give me a … | |
Re: [URL="http://www.cplusplus.com/forum/unices/2047/"]Link[/URL]. Check my last three posts for code. Enjoy! | |
Re: [url]http://www.masm32.com/[/url] Enjoy! | |
Re: You can push and pop it. 1. Call function first time. Answer is in EAX. 2. Push EAX. 3. Call function second time. Answer is in EAX. 4. Pop EBX (or register of your choice). Answer to first function call is in EBX. Answer to second function call is in … | |
Re: Recursion gets people because it is something new --which translates to forgetting all the stuff you already know. In order to determine the maximum number in a list, you need three things: 1. the list 2. the current maximum value 3. something to compare each element of the list with … |
The End.