389 Posted Topics
Re: I'm rusty with Java but... Watch your [] positioning. Also array is an int [] not a class! But you have array.length [CODE=JAVA] BubbleSort( array[], length ); public class BubbleSort { // public int trade( int[]array, int length) public int trade( int array[], int length ) { [/CODE] Can we … | |
Re: You don't seem to be stuffing the letter! To save it! Or some indication you have that letter within the word that was already tested! [CODE=C] if (gameGuess == gameWord[i]) // matching letter found? { myWord[i] = gameGuess; // <---- Stuff new letter cout << gameGuess; } else if (myWord[i] … | |
Re: I too don't exactly see what you're trying to do, however you are using temp before you set it! It's almost like you're trying to create a new list containing characters that occur in both strings. But your algorithm is flawed if so! | |
Re: You're pretty much covered by the other posts but you do need to be more careful of what instructions you use. In this case you're fine, but... [CODE] ; add ax, 30h ; mov [bx], ax add al, 30h mov [bx],al add bx, 1 mov byte ptr [bx], '$' [/CODE] … | |
Re: You want to write your own strcat function? Or you merely want to append two strings together in a buffer? Either way, [CODE] dec di mov al,0 l1: inc di ; scan for end of destination buffer test ds:[di],al jnz l1 l2: mov al,[si] ; copy src buffer to destination … | |
Re: Not enought code, to help you, however Loop decrements ecx and checks for zero. So unless <number> is the loop count, there's a problem. | |
Re: %i ??? do you mean %d or %u ? Did you define iPurchase somewhere? int iPurchase; | |
Re: Memory alignment? See if your data is 16 byte aligned. If the internal algorithm is using SIMD it will run faster when aligned. If misaligned data has to be double copied, or accessed slower. memcpy is also faster if properly aligned! | |
Re: I remember MAC being either '\r' or '\n' only, while PC is definitely '\r' AND '\n' every time a '\n' is encoded! | |
Re: You have an (i) problem. You need to use two different variables within a nested loop, such as i and j. [CODE=C] for(i=0;i<2;i++) // for(i=0;i<3;i++) { for(x = 0; x < 3; x++ ) { total+=num[i][x]; } [/CODE] | |
Re: I personally like the idea (which I use) of a local IP port using a simple message protocol. Your Host Server App opens a listener port on a specified port # using the local IP 127.0.0.1 Your Client App's merely connect to it! | |
Re: Technically each memory you allocated has a hidden header and has been tagged and associated with your application. When it shuts down the memory allocated will be released back to the pool. In reality, you MUST ALWAYS release any memory you allocate, just to be a proper (PROFESSIONALLY WRITTEN) application. … | |
Re: I don't know Python but from an architectural point of view your answer is YES! You said after hours, which implies that nobody is using the computer so it is free to use 100% of its time doing the processing. Dual Core machine doing single-threadded means less then 50% of … | |
Re: This should be the last edit line of your ASM file. (Leave atleast one blank line below it!) [CODE] END [/CODE] Believe it or not, assemblers still require the END keyword. Does this help? One question though. Why do you have this DOS code at the bottom of your file? … | |
![]() | Re: I see a problem but this line doesn't belong! [CODE] if (i < 0) { System.out.println("There are no books avalible"); break; } [/CODE] also at the top of your code... You're returning the garbage pointer after the allocated buffer. [CODE] books[numBooks] = new Book(bookTitle); // ++numBooks; // return books[numBooks]; <--- … |
Re: Choices in preferable order... 1) Go back to school, get your Bachelors Degree in Computer Science. 2) Go back to school, take game development - programming at one of those I.T. schools. 3) Teach yourself, if very good and extremely lucky and beat out the interview competition, you'll get the … | |
Re: You get your initial index but you'r stuck in a loop until you find a non-one! But you never wrap your index! [CODE] while (status_arr[hashIndex] == 1) { // hashIndex ++; hashIndex = (1+hashIndex) % HTableSize; } [/CODE] What happens if no non-ones are found? Infinite loop? Also right now, … | |
Re: How about a sphere instead? But keep it on a z = 0 plane to keep it 2D. | |
Re: Because you're only swapping within the scope of the function. Instead you need to pass the address of the pointers, not the memory referenced by those pointers! Despite that, line 21 was wrong! [CODE=C] void swap(char *,char *); main() { char *x="new"; char *y="word"; swap( &x, &y ); printf("(%s,%s)",x,y); } … | |
Re: Also read up about "Expression Evaluators". These can be fun to build! Start simply two operands, one operator! then work up! Processing 3 * 4 is easy Processing 2 + 3 * 4 Is a bit more complicated. Processing 2 + 3 * (4 +(99 / 9)) Takes a good … | |
Re: You're essentially looking for a card shuffle algorithm but you're using 101 cards. This isn't VB but the principal logic is the same! [CODE=C] LOWCOUNT = 0 HIGHCOUNT = 100 NUM_COUNT = ((HIGHCOUNT - LOWCOUNT)+1) Ary[ NUM_COUNT] // Fill with sequential numbers! for i = 0; i < NUM_COUNT i++ … | |
Re: Bit Magic. You need to post the types of data you wish to store and what the maximum number range is for each! There are many books on the subject! Did you know you can use bit data instead of code branching for faster code in some cases? But keep … | |
Re: val1 = func( &apple, &bat, &cat, &dog ) The address of apple, bat, cat, and dog are now on the stack. here's one method! [CODE] ZZ equ ???? ; I forget the actual number to use try 8? Check your address of those arguments, then in debugger to align them. … | |
Re: You probably already know this but don't forget the +1 in the allocation for storing the terminator. [CODE=C] sz = strlen( s ); char *p = new char[ sz+1 ] [/CODE] | |
Re: Sounds like homework questions to me! Do web search or read your book! | |
Re: Some confusing bits in your code. Sometimes you start your column loop with 1 and sometimes 0. If you used CODE=C you would get line numbers for reference! Remove *rowcount = row; *colcount = col; from within the double loop. You pass in an array of known fixed size MAXCOL … | |
Re: Since you don't know how many factorials there are then use an empty array of N / 2, thus 100 / 2 = 50. Most of it will be wasted but that's fine. Alternatively you'd have to use a dynamic array like an inch worm. Preset a size, fill one … | |
Re: Isn't DOS printing suppose to have a '$' terminator? | |
Re: Your RNG mod is wrong. 1 to 1000 thus 0 to 999 randomNum = 1 +(rand() % 1000); your test is not with your drawn random number! //if (guess != rand()) if (guess != randomNum) Rework your code. Use one input point. Do while loop works. | |
Re: In Real Mode!! DS:1342h Offset:015Ah Real Mode has 1 Meg limit. Segments are on 16 byte boundaries. So Segment x 16 + offset 13420h + 015Ah = 1357Ah Decimal 79226 | |
Re: Just briefly unless your assignment is to use a malloc() you don't need it here... [CODE] widthStr = (char*) malloc(5 * sizeof(char)); heightStr = (char*) malloc(5 * sizeof(char)); //Lecture des dimensions de la grille initiale. fgets(heightStr, 5, grid); fgets(widthStr, 5, grid); //On enlève le "\n" au bout des dimensions. heightStr[strlen(heightStr) … | |
Re: Without a structure... It is unclear what you want! You have a 10x10 array and you want to count everytime that area of the screen is clicked in the cell corresponding to that area, or merely store the X,Y in all the positions? | |
Re: You're talking about a spline! Will there only ever be three points or merely looking at the current three points in an array of points. Do you want the curve to pass through the points or use them as a guide for placing a smooth curve! If you're on the … | |
Re: It's hard to tell from your code since not much whitespace thus hard to read but it appears you're using a linked node before verifying it even exists? You check the base node for NULL but not the friend pointer, you just use it! [CODE=C] if(friend1->friends->person->id [/CODE] This isn't the … | |
Re: Try the function... BOOL GetWindowPlacement( HWND hWnd, WINDOWPLACEMENT *lpwndpl ); | |
Re: An error.. You had a semi-colon on the if() [CODE=C] int main() { double input, answer; double total = 0; unsigned int count = 0; while (cin >> input) { if ((0.0 <= input) && (input <= 100.0)) { // Track number of entries, and sum the running tally. // … | |
Re: Many problems. You're mixing class vs non-class string handling. Use what I'm providing to rework your functions. [CODE=C] const MyString& MyString::operator=(const char* rightOp) { int i = 0; if (NULL != stringStorage) { delete[] stringStorage; } stringSize = strlen( rightOp ); stringStorage = new char[ stringSize + 1 ]; for( … | |
Re: Use a tag... [CODE=C] for line numbering. You have a comparison vs assignment problem for sure.... in two different parts of your code! Please try to align your columns to make the code easier to read! [CODE=C] if (chips1= 0) if (chips2= 0) should be if (chips1== 0) if (chips2 … | |
Re: You really need to post your code. We're working blind! | |
Re: Did you notice your copy assignments are backwards? [CODE=C] void Question::setnumq(int number) { // number = numq; numq = number; } void Question::setnum(int number) { // number = num; num = number; } void Question::setn(int number) { // number = n; n = number; } [/CODE] | |
Re: You may want to mention it is OpenGL. I cut in my own textures and Kind of cool, but I only see one blue planet. Adding your textures would be cool. If you're worried about copy cats, Put a big X or something on your textures so that they still … | |
Re: These sound like teacher assigned problems for you to resolve so I am not going to give you the answer. But I will try to make the array more visual. 24 = sizeof( int b[3][2] ); XX XX XX Array is 2 wide by 3 high. 3 times 2 is … | |
Re: If you merely want a tool, doesn't Microsoft Word have a statistics page indicating number of words in a document? Open the file with that. I use ASCII parsers all the time. ASE file readers, etc. I actually treat it as a gigantic ASCIIz buffer. Get File size allocate size … | |
Re: Your german needs some work! Review your one's list! vw[] zero and one are missing. 10 should be at the end of the list! | |
Re: All my Windows work is still under Win32. Remember in 32-bit land you only have about 3.2Gig totally available to your application, which really works out to about 2Gig because Dev Studio is an oinker! It's a memory hog! Especially in a debug build. You're using C++ compilers and using … | |
Re: [CODE=C] if ( ERROR_SUCCESS != RegCreateKeyEx( HKEY_LOCAL_MACHINE, xREGISTRY_CRYPT_KEY, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dw ) ) { return false; } RegSetValueEx( hKey, xREGISTRY_UA, NULL, REG_DWORD, (BYTE *) &ua, sizeof( ua ) ); [/CODE] | |
Re: if your current posting is correct, sum=0 is in the wrong place. It should be at the top of the function outside the loop. Not reset each pass through the loop! What Vernon Dozler said at the bottom of the post! | |
Re: One method is to have order your instructions call functions above it, so main() would always be the last function! [CODE=C] #include<stdio.h> int f(int aa,float bb) { return (aa+bb); } int main(void) { int a; a=f(10,3.14); printf("%d",a); } [/CODE] | |
Re: Ahem! Given only radius gives you all the other data. No need to input. Circumference = 2 * PI * r Area = PI * r * r etc. I'm also assuming your x is entered as a Floating-Point value. [CODE=JAVA] System.out.printf("Area is %f\n", (x * x * math.PI) ); … | |
Re: BOOM! That's a technical term! Your pointer needs to be pointing at real data! [CODE=C] int *k, v; k = &v; // k now points to the address of {v}. *k=10; // So we are now storing the value // reference by k, meaning v is now equal to 10. … |
The End.