1,118 Posted Topics
Re: Forget Java. If you can do it in C you can do it in MIPS. Remember, a power of two is a number that has only [I]one[/I] bit set (all the rest are zeroes), and that bit cannot be bit 0 (the least-significant bit). Your C solution looks fine. In … | |
Re: Shift "forgets" the bits shifted out. Roll takes the bit shifted out and sticks it back in on the other end. Examples: [code] 01101010 start (one byte) 11010100 shifted left by one 10101000 shifted left by one 01010000 shifted left by one etc. [COLOR="Red"]0[/COLOR]1101010 start (one byte) [COLOR="Green"][B]1[/B][/COLOR]101010[COLOR="Red"]0[/COLOR] rolled left … | |
Re: Yes, but you need to know something about how to create components and interfaces. [URL="http://delphi.about.com/od/comoleactivex/OLE_COM_DCOM_Automation_ActiveX_Delphi_knowledge_base.htm"]I think this page on About.com should get you started[/URL]. It is possible someone already wrote a Delphi interface unit for the COM object you want to use. I would spend a little time on Google … | |
Re: I think that you need to increase your stack size. You can do it from the [B]Options -> Compiler -> Memory Sizes[/B] menu or use the $M directive at the top of your code. [code=Pascal] {$M 32768, 655360} { Twice the default stack size, default heap size } program fooey; … | |
Re: There is no function (AFAIK) that allows you to hook every thread in a single process at once... I would add the hook as part of the new thread startup procedure (either by the caller when creating the thread or just as the first thing the new thread does). Good … | |
Re: If it is core-dumping you still need to potty-train it. Google "linked lists" and read more to learn how to fix your problems. (They are all caused by an improperly-coded linked list.) Also, your setHead() method is [I]very[/I] dangerous: you should not have methods that let things outside your class … | |
Re: Actually, the folks at <whoever owns borland nowdays> have brought back the "Turbo" moniker... So if you go download [URL="http://www.turboexplorer.com/cpp"][B]Turbo C++ [I]Explorer[/I][/B][/URL] you wouldn't have to resort to BGI graphics at all... JSYK. | |
Re: As you can see from the number of postings about this so far, quite a few people have been working on this. I have seen two text-only, ASCII-art versions, and one windows application using images. Add a "7-segment" font to that repertoire and you have a lot of choices... | |
Re: You solved this? Mind posting a quick overview of what you did so others can learn? | |
Re: Actually, for the answer to (1), you [I]can[/I] make the window text bigger by adjusting the font, but you'll need to do it in a shortcut. [list=1] [*]Create a shortcut that starts your gwbasic application. [*]Use the shortcut to start the program. [*]Right click on the console window's menubar to … | |
Re: Is this a trick question? (The answer depends on the machine's addressing scheme ;) ) | |
Re: It has nothing to do with Intel. Every OS must allocate and initialize memory for programs, no matter what chipset you are using. When the OS places your program into memory, it places the various parts in the proper places: Code goes in one place, Data goes in another, and … | |
Re: In Delphi, I like the [B]FormatFloat[/B] function. If you look at the docs for it, you can also check out the "See Also" stuff. | |
Re: Between lines 11 and 12 put [inlinecode]cin.ignore( numeric_limits<streamsize>::max(), '\n' );[/inlinecode] The stream >> operator only reads what you ask it to, and leaves everything else behind in the input buffer. However, whenever dealing with user input you must expect that the user will press the ENTER key after everything you … | |
Re: Yes, it is the same. And (at least by what I see now) his code does start with [B]randomize[/B]. In computers, there is no such thing as a truly random number. Delphi's random number generator is notoriously wimpy. You'll have to google "[URL="http://www.google.com/search?q=delphi+random+number+generator&afid=5052&s=&search="]delphi random number generator[/URL]" or something similar for … | |
Re: That shouldn't work at all. Both [B]upgraph[/B] and [B]downgraph[/B] are defined to take a single argument, but you are passing multiple... That could be the problem. Make sure also that you aren't calling bitset with '(). Sorry I can't be of more help. | |
Re: If by "a few degrees" you mean something other than 90, 180, or 270, then you can't (not without some fancy magic tricks). If by "a few degrees" you mean exactly 90, 180, or 270, then maybe. What OS and WM are you using? Also, what is your video hardware? | |
Re: It just moves data around. [URL="http://en.wikipedia.org/wiki/MIPS_architecture#MIPS_Assembly_Language"]Check out the Wikipedia for a pretty good opcode reference[/URL]. Also, I didn't realize you could use [inlinecode]jr $ra[/inlinecode] in main... I'll have to check that out. (Generally programs terminate using the exit syscall.) Good luck. | |
Re: There are two basic ways. First, you could simply [B]FreeConsole[/B] to get rid of the console window, then [B]AllocConsole[/B] to get a new one. Better yet though, is to use [B]ShowWindow[/B]: [code=C++] #include <string> #include <windows.h> const char STR_CONSOLE_WINDOW_CLASS[] = "ConsoleWindowClass"; std::string GetConsoleTitle() { unsigned long length; std::string result( 1000, … | |
Re: You might want to remember to load (E)DS at the beginning of your program. All the functions you are using (with 'call') have a register call type, meaning that arguments are passed in registers. Hence, to settextcolor( attribute: byte ) the attribute must first be placed in AL (as you … | |
Re: Actually, it is possible. You need to use [B][I]token concatenation[/I][/B]. [inlinecode]#define DEFINE_FUNC( n ) void func_ ## n()[/inlinecode] You would use it in the normal way: [inlinecode]DEFINE_FUNC( 12 );[/inlinecode] The preprocessor would turn that into: [inlinecode]void func_12();[/inlinecode] While I can't imagine why you want to do this, there are, in … | |
Re: Two nested infinite loops? Is that what you'd call an alpha loop? | |
Re: Usually you will have yourself a little function that takes a specific number of bits (let's say just one bit at a time for each branch in the tree). The function will modify a static "bits" variable (say, one byte) by shifting in the new bit, and incrementing another static … | |
Re: You can only delete one file at a time. If you have a list of files, you can iterate through the list and delete each file in turn. [code=C++] vector<string> file_list; int num_files_not_deleted = 0; for (int i = 0; i < file_list.size(); i++) if (!DeleteFile( file_list[ i ].c_str() )) … | |
Re: You have to call ADC after each ADD. (The carry flag is only one bit deep.) Hope this helps. | |
Re: You have a couple of problems. Your "display the array" routine ([B]intarray[/B]) is perfect. Your "search the array" routine ([B]exist[/B]) should look almost exactly like it. (But it doesn't). The [B]found[/B] variables should be [B]boolean[/B]. Also, the found parameter should be a [B]var[/B] parameter. The procedure type should be: [inlinecode][B][COLOR="Green"]procedure[/COLOR][/B] … | |
Re: Don't use [inlinecode]void main()[/inlinecode]. Always use [inlinecode][B]int[/B] main()[/inlinecode]. In "List.h" the Traverse() method is (incorrectly) prototyped as [inlinecode]void Traverse( DataType, int& )[/inlinecode]. In "List.cpp" it is (correctly) defined as [inlinecode][B]bool[/B] Traverse( DataType, int& )[/inlinecode]. Please don't use leetspeak or other weenie talk. (Be kind to those for whom English is … | |
Re: You'll need to track mouse down and mouse up events, then use the Pythagorean theorem. Hope this helps. | |
Re: Typically, your window isn't actually destroyed, it is only hidden. Hence, when you ask to show it again nothing has changed. You will need to add an OnShow event handler to reload your combobox whenever the form is displayed. Hope this helps. | |
Re: You'll need to make yourself a DLL that has the hook callback function. Google "system hook" for information. Hope this helps. | |
Re: No. INC affects O, S, Z, A, and P only. Hope this helps. | |
| |
Re: Why do you keep opening and closing your outfile? (You never do that with [B]cin[/B]...) Get rid of every line that says [inlinecode]outfile.open( ... );[/inlinecode] and every line except the last that says [inlinecode]outfile.close();[/inlinecode], and try it again. Hope this helps. | |
Re: This should get you started. Please note that I've never used Borland C++ Builder, I don't have it, and I have not tested this code. I only translated the [B]EBitmapError[/B] class and the [B]RotateScanline90[/B] function set. Hope this helps. | |
Re: If you are on linux, check out [URL="http://ca.geocities.com/jefftranter@rogers.com/eject.html"]Jeff Tranter's eject[/URL]. | |
Re: In particular, both Gnome and KDE are able to be used as application frameworks. [URL="http://www.gtk.org/"]GTK+[/URL] is a very common, very complete toolkit with C API bindings. Most others I know of are C++... You can also take a gander through [URL="http://www.free-soft.org/guitool/"]The GUI Toolkit, Framework Page[/URL]. Hope this helps. | |
Re: Both are variations on the same thing. First off, each time you [inlinecode][B]readln([/B]key[B]);[/B][/inlinecode] you change the value of [B]key[/B]. So if you ask for it three times, it will only be whatever you entered the third time. I would recommend just forgetting the [B]key[/B] and asking the user to press … | |
Re: I still have no idea why you are having the operand size conflicts. [URL="http://support.microsoft.com/kb/125799"]This is what Microsoft has to say about it[/URL]. The AX is implied in MUL operands, so the third instruction should read [inlinecode]mul num2[/inlinecode] Hope this helps. | |
Re: Glad to hear you've got it working for you. Don't feel bad when people don't reply. A lot of times it is just that no one knows how to answer your question... | |
Re: It sounds like your teacher wants you to use a brute-force method. Just loop an integer from 1 to n and check to see if it divides evenly into your number. If it does, then it is a factor. Your choice of n can be interesting. | |
Re: The compiler is mangling your function name to "C" standards. It is looking for "_hhPostMessageA" instead of "hhPostMessageA" (note the underscore). What you are doing is fairly compiler-specific, but these days a lot of them accept the [inlinecode]__declspec[/inlinecode] keyword. [inlinecode]extern "C" __declspec( dllimport ) void hhPostMessageA( HWND, UINT, WPARAM, LPARAM … | |
Re: I think you are out of luck. [URL="http://searchwindevelopment.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid8_gci1045901,00.html"]See here.[/URL] | |
Re: You should be using [B]unsigned long[/B], not [B]double[/B]. In either case, VC++ could have a problem correctly identifying the size of the operand inside the __asm block. I don't know enough about VC++ __asm to be sure, though... It might be worth pointing your professor to [URL="http://www.masm32.com/"]MASM32[/URL]. Hope this helps. | |
Re: [B]Nand[/B] isn't a single operation. How is [B]nand[/B] defined? That will give you your answer. If you are using x86 assembly, look at the [B]and[/B] and [B]not[/B] instructions. If you are using MIPS, you'll have to think just a little harder: [B]and[/B] and [B]xor[/B]. Good luck. | |
Re: [URL="http://www.cppreference.com/stdother/rand.html"]rand()[/URL] returns a value between 0 and RAND_MAX. You need to apply some math to bound that value. In C++, the remainder operator is [B]%[/B]. [inlinecode]int value = (rand() % 499) +1;[/inlinecode] | |
Re: Your description to us is so vague that we can't really help. How exactly does your professor expect you to display a bmp? Did he provide the bmps to display? Are you using the Windows API or some other GUI framework? What sort of calculations are you doing? What does … | |
Re: At the top of your main program (the .hsx file) you should have something like: [code=Haskell] module MyProg where import Char [/code] In this example I named my .hsx file "MyProg.hsx" but you can name it whatever you like. Make sure to import every library you need. The [B]isDigit[/B] function … | |
Re: Perhaps we should ask: what do you mean by a "table for matrix"? And on what medium do you want to draw it (console, gui window, printer paper)? | |
Re: On lines 7 and 9 you forgot to say [inlinecode][b]p1.[/b]coef.begin()[/inlinecode], etc. Line 17 should have a [inlinecode]==[/inlinecode], not a [inlinecode]=[/inlinecode]. Your iterators have terrible names. Try iter --> icoef1 iter2 --> iexpo1 iter3 --> icoef2 iter4 --> iexpo2 This will help. Now, just remember, every time you increment an iterator … | |
Re: Remember, of course, that in C++ everything is zero-based. So [inlinecode]Value[1][10][/inlinecode] is the [I]second[/I] row and the [I]eleventh[/I] column. A vector, as [B]Jennifer84[/B] demonstrates, is a superior construct, since you get all the benefits of an array without any of the drawbacks. [EDIT] Oh yeah, almost forgot to answer your … |
The End.