General C++ Programming (Page 2)

Do I need a destructor if I allocate memory in a local environment?
 
Say I have a function: void createNode() { Node *someNode = new Node; } When the ...
[2 replies] Last: Okay. So it would be better to use dynamic allocation if you want the ... (by vaderboi)
namespace {…} without any namespace name
 
What actually is meant by namespace {…} without any namespace name which is sometimes seen in C++?
[1 reply] : Unnamed namespace: https://en.cppreference.com/w/cpp/language/namespac... (by JLBorges)
vector.insert() and operator overloading
 
Hey all, In my program, I have a class Route. It has a vector<string> property. After an initial ve...
[15 replies] Last: Here ya go, this one doesn't change the original route. Route Route:... (by pgiovanni)
Vowel chain in binary tree
 
Hi, I'm working on a project : Given an alphabet binary tree, find the length of the longest vowel ...
[3 replies] Last: awesome, your program crashes and you didn't even notice. run your pro... (by ne555)
Force originally global variable to be nearer
 
Is there C++ feature to force an originally global variable to be near or in the closest distant to ...
[3 replies] Last: Great insight! Thanks. (by abdulbadii)
Class function problem
 
Hello. I'm trying to create a function in a class Complex that assigns one complex number to another...
[1 reply] : Since your class just has 2x floats in it, the assignment operator tha... (by Ganado)
Seek example of Range for in C++ 17 where end expression is a different type than the begin expression
 
In dealing with range for in C++ 17 standard, the end expression type may be different than the begi...
[4 replies] Last: :) (by Thomas Huxhorn)
Why use && in range for?
 
Hi, I ran into an example of a range for where the elements are extracted using auto&&. Why is th...
[2 replies] Last: https://blog.petrzemek.net/2016/08/17/auto-type-deduction-in-range-bas... (by Repeater)
LHS and RHS
 
Jojo is learning new subject, Calculus I, and recently he found some difficulties. The Lecturer assi...
[4 replies] Last: Depends on the input format. What's the input format? Is it 1 2 3 4 ... (by Repeater)
Binary tree constructing
 
Hi ! Following is an input files, which states the information of each node in a binary tree : 9 ...
[3 replies] Last: How should I connect each node by using a vector container? Is there a... (by calvinfornia)
How do I create co-dependant namespaces.
 
I have the following namespaces: A.h + A.cpp: #ifndef INHERITANCE_A_H #define INHERITANCE_A_H #i...
[2 replies] Last: to clarify the last part, there is no reason for A.h to include B.h an... (by ne555)
Longest path with same values in a binary tree
 
Hi, here's a source code of a program working on the longest path with same values in a binary tree....
[2 replies] Last: Got it ! Thanks a lot ! (by calvinfornia)
member initialization
 
I would appreciate any help I have a point class as such: class Point { int x, y; pu...
[2 replies] Last: Thank you for your reply. I think I'm supposed to use this inside the ... (by Leo78963)
by ne555
Visual Studio 2017: How to use traditional multi-translation-unit builds for debug mode
 
I thought the whole point of unity build was to reduce build time. perhaps //in main.cpp #ifndef D...
[3 replies] Last: Spam links added in an edit. (by Furry Guy)
C++ PROBLEM (HELP)
 
Ok So i have a university project . i must write a program that allows the user to select if he want...
[3 replies] Last: The code doesn't even compile with the right compiler settings like -W... (by Thomas Huxhorn)
Create a static class function that takes an infinite number of arguments
 
Hello! Using a template I've created a function that accepts an arbitary number of arguments. It's c...
[5 replies] Last: I am also a beginner . So, i just want to know about the given topic w... (by archanasinghr)
Question about 2D Array
 
Hey guys, I have a question. Please reference this YouTube video. Skip to 2:46 minute. https://y...
[2 replies] Last: In an expression like cout << "Hello\n" , the type of the string lite... (by mbozzi)
Pointers and Arrays.
 
cpp.sh/6eukj link above is my code i'm not sure what i did wrong but the personality.out i...
[4 replies] Last: You need to add "9" as the first line of personality.txt. When I do t... (by dhayden)
How to add Error Checking
 
I've written a program to create two random arrays, splice the first up to a point the user chooses,...
[11 replies] Last: std::cin >> firstArraySize; // Assings inputed size to first array. ... (by Repeater)
Reverse 2d array (HELP!)
 
Hello again guys, i have this following assignment: Marks obtained by all students are stored in a ...
[3 replies] Last: Dice que necessitas una lista de las sumas de todos los grados para ca... (by Duthomhas)
Pages: 1234... 14
  Archived months: [aug2019]

Cannot post in this page. To post a new message, go to the first page.