General C++ Programming - June 2011 (Page 16)

uninitialized variable
 
i have a problem with the variable "damage" in here. It turns up as some value like -214555. void Pokemon::attack(Pokemon a,int input) { if(input>4||m[inpu...
[19 replies] Last: ok---you seem quite offended (by thelateryears)
B Tree
 
I need some Help with the implementation of B-Tree with Add() and Search() does anyone have some code that can help me? please
[1 reply] : Why should I do you homework for you? Surely your textbook must cover ... (by Zhuge)
ios_base precision
 
Hi, I'm trying to format a number input as: (12345.35,-55) (-3,34567.99) to produce this output: The Complex numbers are: (+ 12345.35,- 55.00) a...
[no replies]
log4cpp How to add collumn header to log file
 
Hi, I'm new here. I'm using log4cpp as a data logger for my program. Does anyone konw how to add a collumn header for logs files created using log4cpp?? I'm...
[1 reply] : Hi CodeGuy, You are more likely to get a response on the log4cpp supp... (by PanGalactic)
need help in this simple C++ code!
 
when i compile this code it gives 8 warnings ,that the variables u01,u02,u13,u12 etc are assigned the values that are never used ...please tell whats the reaso...
[2 replies] Last: i am usng windows XP,and Turbo C ,i just simply want to evaluate that ... (by ambreen)
Templatise over a container
 
Hello guys, :) I have the following simple function: template <typename type> double vector_mean(const vector<type>& my_vec, double order = 1) { ...
[10 replies] Last: In the case of STL containers it's probably wiser to use the value_typ... (by m4ster r0shi)
floating array passing to function
 
The main function shoud pass to another function a float array and an integer indicating the size of the array and return the average of all the numbers in the ...
[7 replies] Last: Thank you for all your replies but I ended up getting it to work after... (by confusion)
CRecordset open Dsn Diloag VC++
 
Sqlcon.Format(_T("DSN=hassan;UID=has;PWD=123;APP=Microsoft\x00ae Visual Studio\x00ae 2005;WSID=DETECTIVEPC;DATABASE=stock")); database.OpenEx(Sqlcon,CDatabas...
[no replies]
std::map error
 
#include <iostream> #include <map> #include <vector> #include <string> using namespace std; typedef struct { int v; string name; }AuxInfo; typedef s...
[2 replies] Last: Why are you typdef ing unnamed structs? That seems an odd way to avoi... (by LB)
by asdfg
Getting the last line in a .txt file
 
Can't seem to find an easy way to do it, any suggestions/pointers as to what I need to do it?
[10 replies] Last: I would also go with the first solution, but as an alternative you cou... (by kev82)
Read binary file line at line into uint32_t array
 
Hi, I'm learning C++ language and I have a problem with a binary read file. I know how to read binary file line at line and store each line into char variable...
[5 replies] Last: I can read file content but it is stored into buff char * array....th... (by kbw)
by sebgus
Serial communication in C++
 
Hi! I am trying to figure out how serial communication in C++ works. Have found this page, http://www.codeproject.com/KB/system/serial.aspx, and have spent a...
[1 reply] : From the looks of it, I would say the project from codeproject generat... (by webJose)
warning: taking address of temporary
 
Ok, I understand what is going wrong. But how wrong is wrong? Can I use it? int func(const class MyClass *a) { return a->int_member; } int main() { ...
[6 replies] Last: Ok, so I can use it in my code without problems on different compiler... (by Athar)
How to determine the exact memory size of a map container?
 
Hello, I have a question on how to determine the size of a STL map container for TCP transmission. I have a class defined and one of the data elements wi...
[1 reply] : Just serialize the map to a stream and check how many bytes were writt... (by Athar)
remove punctuation but not accents
 
I am using this code to remove the punctuation from a string. str.erase( remove_if(str.begin(), str.end(), static_cast<int(*)(int)>(&ispunct)), str...
[1 reply] : What do you mean "it crashes"? What happens exactly? Is it crashing ... (by PanGalactic)
SFML?
 
Anybody ever used SFML? What's it like; easy to use? Should i bother trying it out? Thanks.
[3 replies] Last: Agreed. Also, SFML uses hardware acceleration, so it works a lot bette... (by strongdrink)
Boost C++ Set up question
 
Hi all, I'm trying to get Boost set up and I'm using this guide: http://www.boost.org/doc/libs/1_46_1/more/getting_started/windows.html#get-boost. I installed...
[2 replies] Last: The guide recommended using a Win32 console application, but using an ... (by zeromeus)
Which Operators to Overload?
 
When creating a class that allocates resources, which operators should be overloaded? Consider this code segment, for example: class ResourceAllocator { ...
[2 replies] Last: Thank you for your input, WebJose . I've modified the code. [quote=... (by closed account zb0S216C)
Why will cin and getline not work,variables not initialize and does anyone know of a way to save?
 
I am writing an RPG, the same one as in the lounge and i am having trouble with cin, getline and variables are not initializing (i am declaring them and where n...
[4 replies] Last: no i have definetely got using namespace std and no endl, cin is alway... (by STLreliant)
Global Initialization
 
In C, this doesn't work... but in C++, we can use a translation unit to automatically initialize a class instance. As a result, you'll find some libraries using...
[7 replies] Last: Singletons have a well-deserved bad rap because a lot of developers us... (by PanGalactic)
June 2011 Pages: 1... 1415161718... 28
  Archived months: [may2011] [jul2011]

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