General C++ Programming - April 2009 (Page 4)

saving tree to file
 
I've been working on a twenty questions game for my last project of the year. I have the game running fine. It starts with only a few nodes, but learns as it g...
[3 replies] Last: See? That's exactly why I said you needed both zeroes. Now you can't t... (by helios)
Differences between Debug mode and Release mode
 
I know that debug-mode-built apps have debugging information and i think that's not all, are there any more differences between them? I have a DLL, which expor...
[1 reply] : As you've mentioned DLLs, I'll assume you're using Windows. As for di... (by kbw)
Odd magic Square problems-struggling with it
 
i've been struggling with the code of this program, i've done most of it but it keeps giving me error messages, need some help with it, any insights would be re...
[3 replies] Last: Mate, i am new to this forum, let me first get used to it. Anyway, ch... (by pacemaker)
Pre-Decaring None Pointer Members
 
I've read that you should not include header files in other header files and that you should instead pre-declare class members. I'm having trouble working out ...
[4 replies] Last: Thanks for the advice Disch. That's pretty much what I already do. ... (by Iyonesco)
Force template argument to derive from a given class
 
Provided the following template: template <class T> class MyTemplate { private: T myData; public: MyTemplate(const T &data) : myData(data) {} ...
[2 replies] Last: There is a very clean way to do this using the Boost Concept Check Lib... (by PanGalactic)
Dynamic size of structure members
 
Hello! I'm still learning C++, and I got stuck learning structures. I'm reading the tutorials on the site, and I found the one about structs. I started playi...
[4 replies] Last: You can. See std::list<> http://cplusplus.com/reference/stl/list/ ... (by Disch)
by Disch
Threading questions
 
I have some situations in a multithreaded app that I'm not sure about. I was hoping someone here might be able to answer these questions. I know on older sy...
[4 replies] Last: Excellent, this is great news to hear. Thanks to both of you. I as... (by Disch)
C++ Homework programs
 
I have a few programs I need help with, here are the program exercises and then my code (which is incorrect) Number 1 "Write a program that asks the user f...
[2 replies] Last: for the first problem... your code is good with days-- but a its a ... (by csiz)
How to make this continue and not wait for input
 
Alright so I'm using the console making it tell me where the mouse currently is. But my problem is with this code it waits for the input or mouse movement. Wher...
[1 reply] : Just figured it out :) (by Mythios)
height of a tree
 
I want to know the ways to find out height (or depth) of a tree. Please suggest some ideas. I have an idea of bread-first-search algorithm. But I'm sure it coul...
[3 replies] Last: I think it should be int tree::getTreeDepth(){ return root->t... (by helios)
Would it be worth inlineing these functions?
 
Just out of curiosity ( I normally stay away from inline functions ) - But would it be worth making these functions inlined - or would it do no good or no chang...
[3 replies] Last: Thanks guys - that helped :) (by Mythios)
search map avoids const methods
 
Hello folks, I am trying to compile the following code: #include <iostream> #include <string> #include <map> using namespace std; class cfos { ...
[3 replies] Last: What if diccfo.find(c) returns diccfo.end() ? (by kbw)
open file from root directory
 
How do you open a file from the root directory without have to type the complete path? string path = "~/data/"; string file = path + "file.dat"; fstre...
[3 replies] Last: It works well. Thanks. :-) (by nikola17681)
MFC and Mac
 
Hi, I want to convert a C++ program from windows to Mac. I have solved now many bugs, but I still need to kill one more. The code needs MFC-headerfiles.. For...
[2 replies] Last: OK. Thanx for your help! Is there anyone, who wants to help me with t... (by MasthaHacker)
Converting this small chunck to c++
 
Alright this is from a tutorial I did a long time ago in C#. foreach (GameObject ball in cannonBalls) { if (!ball.alive) { ball.alive ...
[2 replies] Last: Awesome - thanks bazzy. (by Mythios)
Hanoi Tower Question
 
Alright so I've got the formula fine based off http://en.wikipedia.org/wiki/Tower_of_Hanoi#Recursive_solution. But the Actual Hanoi function itself is confu...
[7 replies] Last: That was more like the answer i was looking for. Thanks heaps kbw! (by Mythios)
Copy-Paste Application!
 
Hello! How can we make a copy-paste by using standard C or C++ libraries? This program should read a string , and paste it to an application that we want. T...
[1 reply] : You can't. Cut/Copy/Paste are environment specific operations. The... (by kbw)
Weird problem at usage short int in struct
 
My code #include <stdio.h> #include <stdlib.h> typedef struct{ char name ; short int num ; short int id ; }Foo ; void g...
[2 replies] Last: I see my big mistake now . Thank you. (by Dufresne)
2-D Array, initialzing problem
 
Have a problem initializing my arra with '*' and then when I cin a X should be put in that row and column of the array.instead I get 42 for the '*' and 88 for t...
[6 replies] Last: As JG05 says declare col. But....it is the col part of the matrix tha... (by buffbill)
by Disch
Functors in Boost
 
So I'm exploring Boost, and am trying to figure out if/how you can make functors with it. An example of what I want is here: http://www.newty.de/fpt/functor...
[no replies]
April 2009 Pages: 123456... 20
  Archived months: [mar2009] [may2009]

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