[Above excerpt quoted from Wikipedia.] New to C++? Welcome! Whether you are new to programming or are coming to C++ from another programming language, it is highly recommended to have a good book from which to learn the language. If you are looking for a good compiler, g++ is the most commonly ...
1
vote
0answers
49 views
Which data structure to represent a triangular undirected graph
I was wanting to create a graph similar to this in C++:
The one I will implement will have more edges and vertices, but will use this triangle style. I was wanting to create something that I could ...
1
vote
3answers
284 views
Excellent knowledge of C++
I recently saw a recruiting page for a software company where one of the requirements was "Excellent knowledge of C++."
Now, I know this somehow implies as expert knowledge of C++, but where exactly ...
1
vote
2answers
152 views
how to nicely use constant std::string in c++
In my current code project, there is an awful lot of constant strings I use to print out error messages.
Hardcoding such strings is generally considered to be bad practice.
Now I'm searching for a ...
-1
votes
0answers
88 views
How can I create a constructor (c++) that creates a null object when it fails? [migrated]
How can I create a constructor (c++) that creates a null object when it fails.
I want to create a class that behaves like DicomImage class from the DCMTK lib
#include "diregist.h" /* required to ...
1
vote
4answers
167 views
What sorting algorithm does STL use?
I recently started using <vector.h> library and I was wondering, since all the operations are already implemented, IF the method of the sorting algorithm is the most efficient one. Everything ...
-1
votes
0answers
72 views
OOP: difference between 'pythonic OOP' and 'c++ OOP' [closed]
This question is kinda similar to and building on What is the main difference between Scripting Languages and Programming Languages? and Differences between "Java OOP" and "Pythonic ...
-2
votes
1answer
159 views
Fine program, bizzare output [closed]
I have been working with C++ on a calculator that does simple arithmetic calculations. The program was taken from the text book by Stroustrup. The program output "nan" which made no sense to me as ...
-5
votes
4answers
116 views
Dont know how to implement what i learned [closed]
This is my current knowledge-
I am a hardcore programmer in c/c++
I know python quite well
Can work on php ruby sql html css,appengine.
I am really frustrated because after learning this much i cant ...
-5
votes
1answer
84 views
Can anyone explain how the linked lists are declared and work, C++? [closed]
I know this is probably the most stupid and low question in here, but I thought I could ask this on Stack.
I need to understand the basic principles behind a linked list, such as its declaration, its ...
5
votes
5answers
487 views
Would “Efficient C++” book be irrelevant now due to compiler improvements?
I am planning on purchasing this book to learn more about C++ programming with regards to fast code. However, the book was published in 1999 and I am worried most of it may be irrelevant now due to ...
3
votes
3answers
54 views
Global Texture Container
For my first large-ish endevor in Open-GL I'm making a simulator of sorts. I've got much of the basic functionality working, but recently ran into a problem. As I've since realized, I originally ...
5
votes
4answers
381 views
Should I use the new C++11 'auto' feature, especially in loops?
What are the pros/cons to using the auto keyword, especially in for loops?
for(std::vector<T>::iterator it = x.begin(); it != x.end(); i++)
{
it->something();
}
...
0
votes
3answers
159 views
C++ “under the hood” books for advanced readers? [closed]
Are there any particularly good books for understanding how C++ works "under the hood"? My reasons for asking this are that I am very interested in C++ performance system programming (low latency ...
-1
votes
0answers
48 views
C++ GCD: Have to hit enter for program to execute? [closed]
I have to write a C++ program to get the GCD based on inputs from user. I completed it except for one detail. If I use command arguments, something my program detects, I for some reason have to hit ...
7
votes
5answers
205 views
What is a good way to represent a many-to-many relationship between two classes?
Let's say I have two object types, A and B. The relationship between them is many-to-many, but neither of them is the owner of the other.
Both A and B instances need to be aware of the connection; ...
-9
votes
2answers
250 views
Boss is confused by the language - Am I being unreasonable? [closed]
In both C and C++ you can initialize a POD (any struct/union in C) with what C++ calls aggregate initializer lists. Example:
struct abc {
int x;
int y;
char const* ptr;
};
struct abc var = { ...
2
votes
8answers
215 views
Understanding C++ for windows desktop application
I've been programming C++ for almost a year, and I've written complex programs however there are a couple of programming features of C++ which I didn't cover up (Classes & pointers), however I ...
-4
votes
0answers
26 views
How to include external library in QT Project? [migrated]
This is my QT Project. I added the external libraries. When i run this program, the following errors are coming:-:-"1: error: cannot find -libxml2" and when i remove "LIBS += -L/usr/local/lib ...
8
votes
2answers
195 views
Best overview to modern C++ paradigms?
I used to write C++ extensively between 8 and 10 years ago. I have since moved on to C# for professional reasons. However, from time to time I see statements like
"If you're still manually ...
1
vote
0answers
94 views
C++ compiler structures such as Virtual method Table etc
I am aware of the C++ Virtual Table which allows dynamic dispatch for doing things at runtime (although if I am honest I am not completely sure of the full list of things it achieves).
I am wondering ...
1
vote
3answers
228 views
introducing pointers to a large software project
I have a fairly large software project written in c++.
In there, there is a class foo which represents a structure (by which i don't mean the programmers struct) in which foo-objects can be part of a ...
10
votes
6answers
552 views
What are the roles of singletons, abstract classes and interfaces?
I am studying OOP in C++ and, even though I am aware of the definitions of these 3 concepts, I cannot really realize when or how to use it.
Let's use this class for the example:
class Person{
...
0
votes
0answers
50 views
Simplest Dynamic Programming article [closed]
i did a little digging on dynamic programming! am not actually getting the concept of it! i request you people to kindly post the link of any article that would be simplest to explain dynamic ...
-2
votes
7answers
267 views
necessity of pointers? [closed]
Is there any case or specific example where we would require pointers for the job i.e. could something that requires pointers could be done without using them? We could send pointers as a function ...
9
votes
3answers
393 views
How to handle interview questions on programming style
As a C++-programmer in interviews I repeatedly found myself in situations were the interviewer wanted to probe my knowledge of good programming style. These typically were centered around basic ...
5
votes
3answers
227 views
When to use typedef?
I'm a bit confused about if and when I should use typedef in C++. I feel it's a balancing act between readability and clarity.
Here's a code sample without any typedefs:
int ...
-4
votes
2answers
61 views
C++ advantages in working with videodata and videodevices [closed]
What are the advantages of C++ over the others languages in working with videodata and videodevices (developing object detection program)?
1
vote
4answers
246 views
How does one interface C++ with the web (at Google, for example)?
Google is well known for the ridiculous amount of C++ they've coded over the years. Correct me if I'm wrong, but a large part of Google's core search engine is written in C++, isn't it? How does one ...
-8
votes
0answers
58 views
Great new CPP learning resource? [closed]
Can anyone report on the accuracy and legitimacy of the resources on this site?
http://www.cppforschool.com/
I'm not advertising for this site, it's a schools website and I don't think anyone would ...
6
votes
4answers
361 views
Where does Objective-C come from? C++ or C?
I am very confused about this programming language, Objective-C, which I heard is used to develop iOS applications.
I know that it uses the principles of OOP. Would it be easier to learn if I already ...
4
votes
5answers
181 views
variable comparison without initialising
I am working with a project in VC++ which involves co-ordinate system having x,y,z axis.
I am trying to check for if a variable(Point with x,y,z values) is assigned on the coordinate system or its a ...
-6
votes
1answer
69 views
Application development in C++ using MFC And Debugging C++ applications [closed]
MFC is Microsoft library. How can we use this library? Can anyone give me some good reference to read about MFC from a basic to an advanced level?
Can someone tell me about static and dynamic ...
2
votes
2answers
105 views
Looking for good testing in multithreaded C or C++ open source projects
I have read a lot about the importance of unit testing, and testing in general. In particular I have read about TDD which, in theory, seems like a good way to ensure effective test coverage for a ...
0
votes
0answers
18 views
arrays rolling 2 dices [migrated]
Write a program that simulates the rolling of two dies. The sum of the two values should then be calculated and placed in a single-subscripted array. Print the array. Also find how many times 12 ...
4
votes
1answer
44 views
Generate analog signal from Windows 7 [closed]
I want to output an analog signal from my Windows 7 computer. The wave will be a combination of about 5 frequencies, with a maximum of 28 MHz. It won't be a problem to generate the wave data with C++, ...
5
votes
7answers
300 views
Which style is better to check and log the error?
I have read some code and here are two ways to check and log the error in cpp code that repeats in my project many times. Which way is better?
1.
bool AClass::myMethod()
{
if (!SomeCondition())
...
0
votes
0answers
86 views
How is this DP solution for this TopCoder prob approached?
I have been trying to solve this TopCoder problem since a while now, and I'm not able to come up with a DP-based solution to this problem (given below). I also found a solution(also given below) by ...
-3
votes
4answers
225 views
Are Java developers becoming less important as JVM/JIT capabilities grow?
(I am asking this from a low latency perspective, but I guess the question applies in normal business domains).
I am deciding whether to try and specialise in C++ or Java for low latency.
My issue ...
2
votes
2answers
147 views
Combining source files, like header files
I have a project where my files have gotten out of hand because of the volume of them. I have started to combine classes of similar types in single header files because you can, and it still is good ...
2
votes
4answers
101 views
A question on nature of generated assembly in C++ and code Algebra
I wrote this code:
#include <iostream>
int main()
{
int a;
std::cin >> a;
if(a*a== 3){
std::cout << a;
}
return 0;
}
On MSVC I turned ON all ...
-1
votes
1answer
117 views
Good book for C/C++/Java [closed]
I'm a math student and interested in programming. As a prospective project I want to improve my skills in programming. I'm familiar with the basic concepts in C++ since I had to attend an introduction ...
-3
votes
0answers
72 views
How to detect when game is launching in Windows [closed]
How to detect when "Video Game application" is launching in Windows Vista? Then I can make action to close chosen applications. I want to use C++ language.
I want to make tool application that will ...
0
votes
1answer
95 views
Is there an open source version check library and web app?
I'm a developer for a cross platform (Win, MacOS, Linux) open source C++ application. I would like to have the program occasionally check for the latest version from our web site.
Between the ...
1
vote
1answer
73 views
How should the cppcms template hierarchy be used
I understand that the hierarchy, in cppcms for templates, goes skin (topmost, representing a namespace), then view (representing a class) and finally template (representing a function).
I want to ...
26
votes
4answers
2k views
When should you use bools in C++?
We had an assignment for our class where we had to create a Tic-tac-toe game. People like to complicate themselves, so they wrote complex games which included menus. At the end of the game, you had to ...
15
votes
5answers
370 views
Why the static data members have to be defined outside the class separately in C++ (unlike Java)?
class A {
static int foo () {} // ok
static int x; // <--- needed to be defined separately in .cpp file
};
I don't see a need of having A::x defined separately in a .cpp file (or same file ...
-1
votes
1answer
81 views
Use of pdb file in release build executables
This question is appropriate only for programs created on the windows platform.
If I build a release of my program with the /Zi option (create pdb file and store path to file in exe) then I don’t ...
1
vote
6answers
346 views
How many of you used to do C/C++ and doesn't anymore? Any tips on re-visiting C? [closed]
I used to code C/C++ and now I don't. I am trying to go back to C and I can't. Because there is too much memory management and constant worrying about what is in memory, whether it is aligned properly ...
2
votes
1answer
109 views
Patterns for Handling Changing Property Sets in C++
I have a bunch "Property Sets" (which are simple structs containing POD members). I'd like to modify these property sets (eg: add a new member) at run time so that the definition of the property sets ...
14
votes
6answers
845 views
Is it a good practice to use smaller data types for variables to save memory?
When I learned the C++ language for the first time I learned that besides int, float etc, smaller or bigger versions of these data types existed within the language. For example I could call a ...