Beginners (Page 3)

Override Class member array variable values
 
When I have an array as a class member variable and I want to override the default values by calling a separate constructor. Is what I am doing the optimal w...
[10 replies] Last: Yes, it's global. But that's fine as it's a global constant. constexp... (by seeplus)
Floats subtraction and comparisons (1,2,3)
 
Hi, I know of the issues of floating point subtraction and comparison issues but I don't know how to resolve them yet. I also know that you can use Boost or oth...
[50 replies] Last: Good info, thanks! It is a public non-static member and I am already ... (by SubZeroWins)
Question about Escape sequences
 
Part I ====== std::cout << "Backslash: \\" << std::endl; std::cout << "Double quotes: \"" << std::endl; I can understand the need of a backslash to inpu...
[8 replies] Last: Thank you @seeplus (by ninja01)
Is there any difference between '\n' and "\n
 
That's right), Is there any difference between '\n' and "\n.
[9 replies] Last: Understood, thank you everyone) (by ninja01)
char8_t (1,2)
 
I am currently using the latest version of code blocks 20:03 But I seem not be able to compile this code: char8_t ch; After couple searches I find out t...
[28 replies] Last: One thing that may not be of much importance at this time, but should ... (by George P)
Child Class reference parent class
 
I am trying to model a car object and I want the car object to have a child engine object but I want the engine object to have a pointer to the car object ...
[8 replies] Last: It could be used for reverse look-up. Given an Engine, what Car is it ... (by seeplus)
What CWG means?
 
In this link: "https://en.cppreference.com/w/cpp/language/character_literal" You can find at the bottom of that page some abbreviation: CWG 912, CWG 1024 ...
[2 replies] Last: Amazing answer, thank you @mbozzi (by ninja01)
Que functions
 
Guys any ideas on how to complete these code including part 2-8 in int main instructions? #include<iostream> #include <queue> template <typename T> ...
[4 replies] Last: enqueue/dequeue are over-complicated. Also there is a memory issue as ... (by seeplus)
Handling duplicate keys as collisions in unordered_map?
 
Hi, New to using hash_tables and unordered_map. I was wondering if there was a way to handle inserting duplicate keys the same way unordered_map handles collis...
[6 replies] Last: Yes, just push back. std::unordered_map <std::string, std::vector <... (by Duthomhas)
Free books (UK)
 
Hello Not sure if this allowed here - if not mods can delete. I have the following programming books which I no longer require: 1. https://www.amazon.c...
[4 replies] Last: I live in France - not too far from you. If I pay the postal charges, ... (by Geckoo)
Trying to obtain 3D vector with multiple 2D vectors
 
Hello fellows. I am trying to push_back 2D matrices I obtained from ontain function and I need to have 3D vector by adding these 2D vectors. TO do so, I coded a...
[4 replies] Last: @Ganado. Thanks you so much :) It is really funny :) I could not see i... (by learner999)
Error when building my class
 
Hi, i am busy with a project from school and i am creating a class of a bank account. When i build the class i get an error on 1 of the functions and i dont und...
[16 replies] Last: Shoh, once again a simple syntactical error... That fixed everything. ... (by MHS1986)
by Geckoo
std::string s or std::string &s
 
All is in the question. I understand the main principle, but I am wondering why often coders prefer the second way. The both seems legits, but there is some per...
[11 replies] Last: I posted a simple question In C++, that's almost an oxymoron! ... (by seeplus)
Last output missing when copying input with multiple lines.
 
Hello, When you copy this whole input: test1 test2 test3 and paste it into the running program below why do you get the output: test1 test2 instead of: test1 ...
[3 replies] Last: How are you terminating the while loop? With Windows as an example I g... (by seeplus)
why does this else if statement never run?
 
for some reason the else if statement to catch if the denominator number is 0 never runs when y is enter as 0. #include <iostream> using namespace std; ...
[13 replies] Last: Yes. I noticed that the same goal can have many different code "shapes... (by Geckoo)
Function to display all stacks
 
What is the error of my void function to print all the displayed stack elements? #include<iostream> class Node{ public: int data; Node *next...
[9 replies] Last: ... and as a class, then consider: #include <iostream> #include <fo... (by seeplus)
Stacks using Array
 
Any ideas on how to convert this program into Stacks that use Arrays? This one right here used an STL. #include<iostream> #include<string> #include<stac...
[5 replies] Last: ... and as more generalised, then consider: #include <iostream> #in... (by seeplus)
About dynamic programming
 
Hi everyone, I am learning to do dynamic programming but as each time I run on a problem that uses dynamic programming in a sim contest, I try to avoid using dy...
[1 reply] : For a couple of articles on C++ Dynamic Programming: https://www.cprog... (by seeplus)
Need Help in installing latest C++ version on Ubuntu please (1,2)
 
Hello, At present I have on my Ubuntu laptop, I have C++ gcc version 11.2.0. I like to upgrade it to GCC 12.2 that was released on August 19, 2022. Are t...
[31 replies] Last: Module support with GCC, starting with V11, is partial. Whatever part... (by George P)
by ICantC
CMAKE query
 
Hello, I'm trying to build a simply text project using CMake for the first time, but I get undefined reference errors for my calls to pdcurses methods (external...
[2 replies] Last: thank you, I'd since looked at that, it turned out that the linking st... (by ICantC)
Pages: 12345... 7
  Archived months: [jul2022]

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