How to execute a piece of code only once??

I have an application which has several functions in it. Each function can be called many times based on user input....

Unit testing destructors??

Is there any good way to unit test destructors? Like say I have a class like this (contrived) example: class X { p...

main.cpp:(.text+0x8f): undefined reference to [object's method]?

I have my main.cpp : #include <boost/thread.hpp> #include "../headers/BoostUDPSender.h" #include "../headers...

C++ Reading from file into class object array to print 25 lines?

I am trying to this homework for my c++ class and I have been working on it for a few hours now and am not making an...

File first line is not read in c++?

in.open(filename.c_str(), ifstream::in); string name, email, group; while (in >> name >> email &gt...

what is the difference between the system development life cycle and the project life cycle??

i know DSDM consists of different phases, and phase two is the project life cycle, but what is the difference? ...

Opening and Displaying an Image in C++??

Basically I am teaching myself C++ and part of the program function will be to open and close an image specified. Ho...

How to uppercase/lowercase UTF-8 characters in C++??

Let's imagine I have a UTF-8 encoded std::string containing the following: óó and I'd like to convert it to the...

Do I always have `(a / b * b) + a % b == a` when b is not zero??

For int a, b, I know that when there is exactly one of a and b is negative, the result of a / b and a % b is machine...

Forward declare typedef within C++ class?

What's the best solution to forward declare a typedef within a class. Here's an example of what I need to solve: c...

size vs capacity of a vector??

I am a bit confused about this both of these look same to me. Although it may happen that capacity and size may diff...

Switch windows in QT GUI app?

I am trying to make a link between my 3 windows , so I put this in my mainwindow.h : #ifndef MAINWINDOW_H #define M...

Thread joining using a destructor?

This is a continuation to my question: Thread creation inside constructor Now that I have successfully created a th...

Returning Coins From a Vending Machine?

I am trying to make the vending machine output coins for the total amount of change, starting with quarters and goin...