279 Posted Topics

Member Avatar for keyser soze
Member Avatar for ArkM
0
120
Member Avatar for moshe5

Firstly, you shouldn't mix tabs and spaces or you get badly formatted code. To solve your problem, it would be easiest to set the array element to -1 instead of 0 in "recursive". This means you will have to change the previous "else if" clause to [code] else if (copyArray[x][y] …

Member Avatar for Lerner
0
115
Member Avatar for VBNick

I believe you can put this in main.h: [code] extern CAMARA camera; extern OBJECT *obj; // should probably be a longer name for a global [/code] and then in main.c you just put [code] CAMERA camera; OBJECT *obj; [/code]

Member Avatar for VBNick
0
298
Member Avatar for TheBeast32

It is ridiculous to use memset to set a single character! It is also odd to dynamically declare memory (for pass and user) when you could just use automatic variables. As for LogonUser, you need to declare a HANDLE (not a PHANDLE) to recieve the user token. You pass it …

Member Avatar for nucleon
0
215
Member Avatar for kishore84

Use fscanf instead of fgets and strtok. E.g.: [code] float a, b, c, d; int n; char str[100]; while (EOF != fscanf (file, "%d %f %f %f %f %s", &n, &a, &b, &c, &d, str)) printf ("%d %.1f %.1f %.1f %.1f %s\n", n, a, b, c, d, str); [/code]

Member Avatar for nucleon
0
272
Member Avatar for RexxX

Here's a fix for your "incompatible pointer type" error. [code] strings = (char **) malloc (total_str * sizeof( char *)); for (i = 0; i< total_str; i++){ strings[i] = (char *) malloc (STR_LENGTH * sizeof(char)); } [/code] And of course you can malloc an array of structs. BTW, when you …

Member Avatar for Ancient Dragon
0
110
Member Avatar for krispygrimace

The arity and precedence of operators is fixed by their standard usage in C++. So / needs two parameters.

Member Avatar for nucleon
0
99
Member Avatar for billchow24

[QUOTE=billchow24;802047]Place all the nodes in odd positions before those in even ones. For example, the list {a, b, c, d, e} will become {a, c, e, b, d}[/QUOTE] Create two empty lists, listOdd and listEven. Create a bool "toggle" initialized to false. Loop through your original list, placing the element …

Member Avatar for Freaky_Chris
0
870
Member Avatar for slimjimmer

You can replace your entire switch statement with [icode]table[lattice[i][j]][1]++[/icode]. By the way, you are using [icode]++[/icode] and [icode]--[/icode] incorrectly. It is NOT [icode]a = a++[/icode], but simply [icode]a++[/icode]. As for the segfault, it may be because of the way you are using rand(). Try changing everywhere it says [icode]rand() / …

Member Avatar for slimjimmer
0
150
Member Avatar for h3llpunk

Try SRCCOPY in your first BitBlt. Look into other modes if that doesn't do what you want. Also check out TransparentBlt which allows you to have a transparent rgb color.

Member Avatar for h3llpunk
0
204
Member Avatar for astropirit

I don't know if this is the problem but check your variables "handle" and "handle2" everywhere you use them. If it still doesn't work, then what exactly do you want it to do and what is it doing?

Member Avatar for nucleon
0
117
Member Avatar for drjay1627

You need to increment the array index to point to the next element for each character read. Here's an example. [code] #include <stdio.h> #define SIZE 1000 int main() { int c, n, i; char a[SIZE]; FILE *file; file = fopen ("filename.txt", "r"); n = 0; while ((c = getc (file)) …

Member Avatar for drjay1627
0
106
Member Avatar for msshapira

Your GetMin algorithm looks okay. You should post more code. The problem could be in Smallest4 or with the initialization of your matrix.

Member Avatar for nucleon
0
111
Member Avatar for jladd5

Extraneous semicolons are fouling up your logic. Remove them. [code] else (trump == "S" || trump == "H"|| trump == "A" || trump == "D")[color=red];[/color]{ //Won Enough score= 30*(numTricks-6); } if (trump=="NT")[color=red];[/color]{ score=20*((numTricks-6)+(10)); } [/code]

Member Avatar for StuXYZ
0
290
Member Avatar for ajhais

ajhais, It should actually be a Breadth First Search (BFS), not a DFS.

Member Avatar for Prabakar
0
105
Member Avatar for Kraizy

What if there are two or more spaces between two words? So you should skip any initial and final spaces, and count any intermediate spaces as one even if there are more than one. And then add one (as long as you found at least one non-space on the line, …

Member Avatar for axyelp
0
180
Member Avatar for telemachos9

new returns a newly allocated address pointing to enough memory to hold a name structure. BTW, your use of the word "member" threw me off at first because the members are string, next, and value, which don't enter into your question.

Member Avatar for telemachos9
0
102
Member Avatar for marcosjp

There should be an option to not create a console window for a "console" program. There is in Dev-C++ (with gcc).

Member Avatar for marcosjp
0
165
Member Avatar for Skorpion

csurfer makes an important point about testing only up to the square root of num. It will actually reduce the number of comparisons to much less than half. For example, with the number 101 you only need to test up to the number 10 -- quite a savings! To reduce …

Member Avatar for Skorpion
0
80
Member Avatar for sarawilliam
Member Avatar for donjohnson24
Member Avatar for Rein Valdez

That's not Aia's code, and it seems to be incorrect. Here's a working example. It lacks proper error checking for strtol, though. See the link in Aia's post above for the scoop on strtol. [code] int main (void) { char *number = "1234.56"; char *decimal; long int fraction = 0; …

Member Avatar for Aia
0
162
Member Avatar for marksmania

It's been printing the number correctly all along. Since there are 33 zeroes after the decimal point before the 626 part, you get (approximately) zero! Use "%e" to print the number in exponential notation, or "%g" to print it in whichever is more compact. As for "%lf" it is best …

Member Avatar for csurfer
0
98
Member Avatar for sambafriends
Member Avatar for Helgso

This seems to work just fine: [code] #include <stdlib.h> int main() { system("move \"folder 1\\test.txt\" \"c:\\test.txt\""); } [/code]

Member Avatar for Helgso
0
2K
Member Avatar for Superstar288

It's unclear what you wish to do. Do you expect the user to enter a single character? If so there is nothing to count (it's ONE character). So I'll assume you expect the user to enter more than one character and you are trying to count how many of each …

Member Avatar for Superstar288
0
117
Member Avatar for gunjanagrawal
Member Avatar for Srynx

In [icode]num=((int)ceil(((double)rand()/RAND_MAX)*(max+1)))%(max+1);[/icode] You are dividing and modding at the same time. You need to choose one or the other. With division (and floats): [icode] num = (int)(((double)rand() / (RAND_MAX + 1)) * max);[/icode] or with modding (and ints) [icode] num = rand() % max;[/icode] These both give between 0 (incl.) …

Member Avatar for nucleon
0
126
Member Avatar for GirouxCalder

You have [icode]maze_in.get(ch) >> maze1[i][j];[/icode] It should be more like [icode]maze_in.get(ch);[/icode] [icode]maze1[i][j] = ch;[/icode] or [icode]maze_in.get(maze1[i][j]);[/icode] Also, maze1 may be better as type char instead of string.

Member Avatar for nucleon
0
115

The End.