General C++ Programming - September 2011 (Page 28)

BFS with Adjacency List!
 
Hi everyone, I have created an adjacency list and I want to apply the BFS. Anybody can help? Thanks in advance! #include<stdlib.h> #include<iostream> ...
[2 replies] Last: There are no errors. I made the adjacency list (with dynamic values) a... (by mayaniak)
Template function with two classes rejects default arguments
 
Hello, It seems a template with two generic types prevents default values from being recognized. template <class T, class S> void fubar(T foo, S bar = 0) {...
[2 replies] Last: My current solution is similar to that. template <class T> void fuba... (by Blackavar)
bad_alloc with no memory leak? (1,2)
 
Hello guys, :) I'm facing a very weird problem. I got in my program an std::bad_alloc exception in a program that has no leaks at all. I don't have much expe...
[29 replies] Last: OK. I'll do my deepest checks for uninitialised variables, and everyth... (by TheDestroyer)
by Jimbot
OOP Design - passing data down through classes
 
Hello, I'm after some object-orientated design advice..... I'm making a BlackJack game. Up until now my player class contained a member called Hand which...
[2 replies] Last: Hi Disch, Thanks for your reply and for the slots suggestion - I thi... (by Jimbot)
Std::vector<string> problem
 
Hi i using std::vector for fields... i have ifs when i doing editor for WoW. I have problem with vector when i loading expansions, i have expanion 1,2,3 and all...
[no replies]
Problem using a template outside a DLL library
 
Hi, I've got a problem using a template outside a DLL library!!! I’ve got a Class TestClass. In TestClass, I’ve got a standard function and a tem...
[no replies]
help with SuperSmashBro's type game
 
I need information to be passed from CharSelect::Logic() and MapSelect::Logic() to class Game. My state machine looks like this: while( currentState->nextSta...
[7 replies] Last: Okay i figured out what im looking for is called a Stack Based State M... (by nano511)
multiple files
 
hello all! I'm new to C++ and I'm trying to make a program that has multiple files in the main.cpp I did #include <iostream> int main() { using...
[1 reply] : When the compiler gets to line 5, it sees that you want to use a funct... (by Moschops)
by mahkoe
a few questions about the iostream source code
 
Wanting to view the source code for iostream, I open the header file, and attempt to see what's going on. Several questions pop up and I was wondering if anyone...
[5 replies] Last: --please mark us solved-- (by HenriK)
Bool Function(int, string) help it does not work as i want
 
Hello Guys, I have like this in a file : OK Green > start 1 OK Green > start 2 No Green > start 3 OK orange > start 1 No orange > start 2 No orange > start 3...
[7 replies] Last: Ok Thanks, a lot for that, was very useful . q1:does make deference if... (by john1984)
by fsshl
compile error after change int to complex
 
Dear c++ expert:(I am using g++4.6.1) I have the following code to do some math and I like to change from int type to complex type ---------------------------...
[4 replies] Last: thanks (by fsshl)
by fafner
Curious "undefined reference to vtable"
 
My application was compiling just fine, until I needed to add a variable to one of the classes. The class is as follows: #ifndef __VIEWPLANE__ #define ...
[3 replies] Last: Wow, I solved it right after my last post! It turned out that for some... (by fafner)
STL Vectors
 
Does anybody know how to make a vector using STL as a private variable member function of a class? I am trying to make a vector of objects. I used: #...
[1 reply] : "a private variable member function" I presume you mean "a private me... (by Galik)
by warace
My first program. I need some help.
 
Okay I am on a debian linux system using Code:Blocks ide. I'm trying to make a simple Currency converter (USD to CDN & vice versa) that runs on a console. I set...
[6 replies] Last: woops! Thank you wolfgang. All I had to do was change that int to floa... (by warace)
typename error
 
Now i have something like template <class T> class A { public: typename map<int,T*>::iterator Iterator; Iterator func(){}; }; ...
[2 replies] Last: Oh finally.. First i did something like; typedef map<int,T*>::iterato... (by mindfog)
Curious about difference between 'for' and 'while', CPU wise
 
Hi everyone. I have a very small question out of curiosity. I learned by myself and testing that you can add more expressions inside the for loop structure...
[5 replies] Last: It's not even necessary to perform optimizations. A for can be treated... (by helios)
by yeoj
Calling an .exe file
 
I am trying to make a file that checks if a text file is present. If it is then it calls one .exe and if it doesn't exist then it creates that file. How would I...
[1 reply] : How would I check ... if(ifstream("C:\\path\\to\\file.txt")) // ... (by Syuf)
Input problem.
 
Hey, I'm trying to take in strings as an input and place them in a vector, stopping when the user presses the return key. The relevant part of the code looks l...
[5 replies] Last: Ah right. Yep, that would work. Thanks. (by Luke Victory)
Recursive Reverse Void Function
 
Hey everybody, So I'm working on a homework problem. We are implementing a bunch of different functions to manipulate and test c-strings. The catch is we ar...
[13 replies] Last: Here's what I was going for (only predefined function use is strlen): ... (by shacktar)
Using the 'continue' keyword.
 
I've been told that I should always avoid using continue to avoid creating spaghetti code. Are there situations where it is appropriate? For fun I've been t...
[5 replies] Last: Continue like any other keyword is just a tool that you have at your d... (by quirkyusername)
September 2011 Pages: 1... 262728293031
  Archived months: [aug2011] [oct2011]

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