General C++ Programming - March 2012 (Page 24)

Random Numbers
 
I've been writing some code that uses the rand() function and I have been noticing that the average number is not right in the middle of the set up slightly bel...
[6 replies] Last: If you're looking for random number between 0 and 1 just calculate r... (by Muckle ewe)
knowing when to do round error correction
 
I'm working with floating point binary numbers with my C++ library called Heap Variable, which can be found on sourceforge.net My problem is I don't know how...
[1 reply] : You should probably read a bit about how floating point numbers are re... (by kbw)
Difference amongst macro NULL an '\0' character
 
Hello! Hope all of you are fine. 1. Can anyone explain to me, what is the difference between NULL and '\0' (which is also referred to as NULL character)? - I...
[6 replies] Last: http://stackoverflow.com/questions/2759845/why-is-address-zero-used-fo... (by cire)
optimization of this algorithm?
 
void teest(int *prm1, int prm2) { int m, n, tmp, flg; for(m=prm2-1; m>0; --m) { flg = 0; n=0; while(n<m) { if ( prm1 ...
[10 replies] Last: and, by the way, the first optimisation IS NOT included by your first ... (by viliml)
by aryu
I dont know how to do this.. Anyone please
 
I am trying to make it read: First Name: Last Name: Score 1: " " More? Y Score 2: " " More? N That is the output but when it asks 'more?' whatever I pr...
[4 replies] Last: tyty (by aryu)
output and input to/from file?
 
i wanna be able to save certain variables in my program, like levels in a game for instance. the only way i can think of is to save the variables to a .txt file...
[6 replies] Last: thanks mate :) (by even821)
iostream equivalent of printf("% N.Me", arg);
 
When using printf to output data, you can use something like below to get the data to line up column-wise. printf("% .5e", arg); The above will print a number...
[2 replies] Last: Took me some time but I figured it out. #include <iostream> #include... (by mmccarty12)
Passing a string to ofstream
 
I have code that developes a string. I intend to pass this string to ofstream for the file name. What is the right way of doing so? // Pass stri...
[4 replies] Last: So for backwards compatability with older compilers use: // Cast... (by Enforcer83)
Need help putting this together.
 
I need help putting my time converter and measurement converter together, i know what to do, simply create a menu that either calls the time conversion or the m...
[7 replies] Last: yea i tried that but for some reason it won't work (by Crimzon)
need help
 
i am teaching my dad c++ and we made a simple calculator. i was trying to get the program to ask the user if he wanted to restart and i thought i knew how. im...
[10 replies] Last: dear OP: You should also declare your variables inside of main and gi... (by ceruleus)
by rubix
offsetof; what's /really/ POD?
 
from http://www.cplusplus.com/reference/clibrary/cstddef/offsetof/ : "...non-derived classes with only public non-virtual member functions and with no constr...
[3 replies] Last: Azagaros, I don't think what you suggest is possible: http://codepad.... (by rubix)
C++ to C#
 
What is the easiest way to use C++ code in C# if I am wanting to use C# for a GUI? If it is possible could show a little code that has everything I will need to...
[2 replies] Last: I'm aware of that. My program is currently 600+ lines and it seemed a ... (by wbeasley)
deleting base pointer
 
Hi Folks :), I need your help, I am getting segmentation fault for "delete bptr_1" ( please refer program written below ). If i remove statements "delet...
[4 replies] Last: Line by line analysis of your code: int main() { base *bptr_1 = new... (by clanmjc)
serialize table of objects
 
Hi. I have a question about serialize and desarialize dynamic table of object's. Let's say I have a class CTowar_internal: class CTowar_internal { int a; ...
[1 reply] : Consider using formatted i/o instead of unformatted i/o. And a std::v... (by JLBorges)
by viliml
bug in INCREMENT?
 
I made this program: #include <cstdlib> #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int n, i, ...
[16 replies] Last: Ok, thanks, I got it working now. BTW, this is the whole code: #inclu... (by viliml)
Write wide-characters in a STATIC
 
I am trying to do this and I get some weird results. I create a STATIC control with CreateWindowEx but the text of the STATIC control is some rare characters. ...
[2 replies] Last: Thanks! (by alexbnc)
Unresolved symbols and other problems (Crypto++)
 
Hi guys, Im, pretty new to programming and I am having a few problems. I am making a windows form program for storing encrypted passwords. I have created ...
[4 replies] Last: What do people normally do when using Crypto++ and Windows forms? As t... (by closed account 937X92yv)
New to fstream/argc and argv, is not displaying results ? (Grep program)
 
I'm currently creating a program that will allow a user to look for a word inside of an input file, then print the whole line in which the program found that wo...
[1 reply] : because while( !in.eof() ) { getline(in, line); cout << line << en... (by PitDaAnimA)
Reinitialization of iterator in case of vector
 
Hi All, I am using insert operation in vector. After doing first insert operation iterator needs to be reinitialized. but in case of set it is not required. ...
[4 replies] Last: Because vectors shall have one memory block for all its elements as bu... (by vlad from moscow)
Easy GUI
 
I have qt and vs2010 and netbeans. I also have a fully functioning code. The sad thing is I have NO idea how to integrate it with a gui. I understand the basics...
[no replies]
March 2012 Pages: 1... 2223242526... 49
  Archived months: [feb2012] [apr2012]

This is an archived page. To post a new message, go to the current page.