Search:
Type: Posts; User: riis
Search:
Search took 0.37 seconds.
-
For both signed and unsigned integers: if the result is smaller than one of the input values, then an overflow has occurred as well. If you add a negative value, treat it as a subtraction of a...
-
I wouldn't give a binary file a TXT extension ;)
-
If the CAge class contains non-public members, and you want to output them, then you need to make the overloaded operator<< a friend of the class, or operator<< should call a method in the class...
-
In case you want this to be a part of a struct/class, you should create methods named "read" and "write" (or what you prefer). Since these methods are part of the struct/class, they have the...
-
Writing the string
char *str;
int stringLen = 100;
str = new char[stringLen]; // Allocate memory the C++ way if you're using C++
memset(str, 0, stringLen); // The new operator doesn't...
-
Ah, I see, the ^ isn't relevant here. Any binary operator could've caused this "effect".
It's pretty much the same as that the evaluation order of function parameters doesn't have a fixed order,...
-
Expressions within parentheses are always evaluated first, before the surrounding expression is evaluated. In case of assignments, they're executed during evaluation.
It would be an error if the...
-
Indentation (directly before printing the first date):
int i;
for(i = 1; i < d; i++)
{
printf(" "); // three spaces
}
The code will not print an indentation when d = 1 (since the...
-
I'm not twanvl, but I hope you don't mind ;)
In C++ the file classes are implemented as streams, just like cin/cout. Since there are several different types of streams (files, stringstream,...
-
Hello all,
A while back I came across a great site (Association of C and C++ Users, ACCU) which contains many book reviews on many subjects (but mainly aimed at C and C++). If you're have some...
-
Sometimes the namespace prefix doesn't help you. Today I had a case with std::min and std::max. I was using them (VC++6) in my code, but I also included Windows.h, defining NOMINMAX in order to be...
-
It's off-topic, but you should know that there are many free compilers which support the latest C++ standard*, so you can use STL, etc. Examples are mingw, cygwin, borland C++ builder 5.5,...
-
There are several things going wrong here with "resizing the array" and "storing the file name".
I could do two things now, namely 1) explain what's going wrong and way, and tell you a much better...
-
This depends how the stream is opened. If it's a text stream (no std::ios::binary), then it is different, because Windows always inserts a carriage return before the newline. If it's a binary stream...
-
Nice formula, I've never seen it :)
My way is much simpler to visualize. You can consider it as the integration between points i and j. The needed division by two (average Y value) is done later...
-
Not in c/c++, it's not a monster like IIf in VB, although the syntax looks monstrous :)
-
Another way to get the sign is: int sign = (val != 0) ? val / abs(val) : 0;
Then: val = abs(val);
and execute the rest of the code.
-
In case you're programming for Windows, look up the FindFirstFile / FindNextFile API's at MSDN.
-
It looks like a constructor, but it is not.
The problem is that "blahClass" and "blahFunction" should be equal, in order to be a constructor.
If this is the case then
blahClass::blahClass()
:...
-
If you're reading the data with a loop like "for(i = 0; i < row; i++) { for(j = 0; j < column; j++) ... }", and you want to transpose (switch rows and columns) it, you should write it with a look...
-
There's nothing wrong with that. The only relevant difference between a 1D and 2D array in this case is that a 2D array is a 1D array, cut in parts of equal length, and stacked below each other.
...
-
There's a problem in the line "for (cluster = 0; cluster < cluster_num; cluster++)"
Check for "cluster < cluster_num - 1" or bad things (undefined behaviour) will happen.
Also, your code doesn't...
-
I've djusted Wossname's code a bit. It's also valid C/C++ now.
There's no need to check for 0 or to calculate the number of digits.
BTW, it won't work for negative integers.
-
You're not setting the "reference" of the variable to another variable, but the address.
This line (CONTROLSET * msgCSet = &Cset;) is wrong, since Cset is already a pointer to CONTROLSET. You should...
-
I guess you mean addr & ~0x03 :)
-
When you got the lib file, weren't there any other files at the place (or perhaps documentation)? If you only have a lib file, then you can't do much.
(Perhaps there are tools which generate...
-
If the function is meant to be called from VB, then the "calling convention" should be mentioned in the function somewhere. It has to do with the way how VB calls function, as opposed to C. I won't...
-
You need a header file where the function is declared. (Or if you know the exact definition of the function, you can put it in one of your own header files.)
Apparently it's something like:
...
-
He said 32 bit.
A DWORD is made up of two WORDs, and one WORD is made up of two bytes. Those are types used in windows. As you know, a byte is made up of eight bits, so 8 * 2 * 2 = 32 bits for a...
-
Perhaps you're including the file with the class definition multiple times?
Place include guards around the content of the class definition file to prevent it from being included two or more times....
-
-
List of nodes at the various stages:
D
DB
DBA
DBC
DF
DFE
DFG
-
Suppose you have the following (binary) tree (D is the root):
D
/ \
B F
/ \ / \
A C E G
-
You should look in the last line of code before line 125. Look at the end to see if there is a semicolon present.
Keep in mind that compile errors often are related to previous code.
-
Aren't we using logic then? ;) The only thing that is random in my program is that it's completely unbiased in which direction the player should go the next move. There's no fixed set of rules from...
-
picosecond (10-12 second)
femtosecond (10-15 second)
attosecond (10-18 second)
-
The deadline has been extended to next sunday, so you still have a couple of days to work on it any further. Electroman also has posted it on the first page of this thread.
-
Steven, I do not agree with your opinion. The way how you implement your algorithm is a choice. You'll be lucky, or you'll be unlucky with your guess. I see that as a part of the game. If I would be...
-
(From the first code block.)
A few questions:
* Does any_string have a c_str method? It's not mentioned in your first post.
* What does any_string_cast do?
* Why can't you also use the c_str...
-
In what circumstances do you intend to use any_string.
Only as a function argument, or will it be possible to replace any_string throughout the entire program where it's used? (The latter will be...
|
Click Here to Expand Forum to Full Width
|