General C++ Programming - June 2010 (Page 6)

by Ritsu
Changing from dead to alive
 
if ( (shipArray ->getBelongs() == 2) && (shipArray ->isAlive())) { cout<<"Hit!\n"; } need help for this, how do I declare my ship isA...
[11 replies] Last: Thanks for the help!! =) (by Ritsu)
Aggregation and function template question
 
Hello Ive been using a mud source code which is written in c to learn how to code. I am trying to convert it to c++ as i go. My first question The cl...
[2 replies] Last: Thanks Galik , i had experimented with stl lists before without luck b... (by judas97)
Problem with storing pointer
 
Hi all, I have a void pointer (args) and I want that pointer to point to a function pointer. I have this: Thread(void (*workerFunction)()) { args = new ...
[17 replies] Last: Uh... No. void function_with_callback(void (*f)(void *),void *da... (by helios)
by briler
Cosructor without ()
 
In my code i have a call to a constructor and the call is without (). object * t = new object; the constructor is without parameters. the code compiles an...
[2 replies] Last: thanks! (by briler)
C++ Interface(s) on Platforms (Windows, Linux, MacOS)..
 
You can suggest the interfaces (executor) could make easy you work on! Currently, I am using dev C++ application because of simplicity. However, I am new at it...
[2 replies] Last: The interface you're speaking of is an IDE (Integrated Development Env... (by Bo Pace)
by everid
header file question on linking error.
 
I include the same header file in 2 cpp files and get an link error for sure. The header file defined only a namespace and an int. //header.h #ifndef HE...
[7 replies] Last: oh, I see, i need to change a.cpp to namespace My{ int a=10; } ... (by everid)
by vivmen
problem with auto_ptr
 
Hello All .. i am getting strange errors when trying following code . any idea ? i am using vc++ 2008 thanks in advance. vector<auto_ptr<int>...
[4 replies] Last: Thanks To all. boost will solve my problem. (by vivmen)
by meocta
copy-constructor is preventing me from returning a temporary
 
Hi, I have a bit of a problem that looks as fallows: class cls { public: cls () {} // the problem is here // cls (cls& ) {} const cls func (cls& )...
[3 replies] Last: C++ syntax and the resulting compiled code are 2 different things. ... (by Disch)
2 Easy Enum Questions
 
My first question is about how to create a private static member variable which is an array of enums, and where the enum is also defined within the class. That...
[5 replies] Last: helios, thanks for that explanation. just to clarify: using an enu... (by Jonah11)
Programming Principles and Practice using C++ - Stroustrup
 
Hello Forum Plz, am new to this forum and a beginner of C++ selfstudy. I have came a cross a lot of books over the net but am just student in Africa and...
[2 replies] Last: You can download lot of books from torrent. See this: http://cplusplu... (by R0mai)
_CLASSDEF
 
_CLASSDEF(classname) What is the use of this code. I came across this in many built in header files but couldn't figure out what it is for. This comman...
[3 replies] Last: sorry I couldn't reply for a while. I had posted some of these head... (by diffthinkr)
Finding Endianess
 
Hi I came across a code to find the endianess, wherein a union containing an integer and character is initialized and the integer is set to 1. Now, say that ...
[9 replies] Last: [quote=helios]The only difference between char and int is that char is... (by helios)
Some doubts regarding NULL pointers
 
Guys, I have the following doubts regarding NULL pointers, 1. Can we have a pointer to a NULL pointer ? 2. What happens when a NULL pointer is dereferenced ...
[1 reply] : 1. yes 2. usually some kind of segmentation fault or access violation... (by Galik)
Operator Overload >>
 
I am trying to read data out of my txt file the text file got vector for example (-1,2,6) heres what i am trying to do but its not working vector<int> v1...
[9 replies] Last: ok guys thanks alot i got it working void read(){ fstream myfile... (by aymank1985)
Char split
 
Hey all, I have this textline in a char: 0x0BOF00x0S0x00x0EOF00x0S0x07101 or in pieces: 0x0BOF0 0x0S0x0 0x0EOF0 0x0S0x0 7101 but when I split it (spl...
[8 replies] Last: @R0mai tnx it works, I will search it out further tomorrow (by closed account G26pX9L8)
Down Caste a class
 
Hello guys . I have my class vector as follow: template <class T> class vector { public: vector(){vector(0,0,0);}; vector(T ,T ,T ); f...
[5 replies] Last: Yah the use of this project is to replace the normal vector class , I ... (by aymank1985)
byte order in a union and endianness
 
So do I get it right, that on different platforms the outputed chars can swap depending on system endianness? #include <iostream> using namespace std; ...
[4 replies] Last: Well, for those reading this, but not much interested in unions: the s... (by KarlisRepsons)
Time Conversion
 
Hello all, I want to convert a time string to a char. I tried many things and some works but thats all not what I want. I want to get the current time in sec...
[8 replies] Last: Ok tnx all problem fixed (by closed account G26pX9L8)
How do you "force" screen size.
 
I'm using Visual Studio C++ and I want to control the size of the window when my code (console app) runs. I can do that on my home computer, but when I send my ...
[4 replies] Last: I got the console app window to fill the screen using: HAN... (by brian20)
by R0mai
Custom operator new/delete
 
I'm using a class from which a lot of single instances are allocated and deallocated at the same time. To make allocation more efficient I thought I would give ...
[no replies]
June 2010 Pages: 1... 45678... 18
  Archived months: [may2010] [jul2010]

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