Beginners (Page 4)

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)
Is this a namespace collusion?
Consider the example below: namespace ns1 { void func(void){ std::cout << "I am inside ns1" << std::endl; } } namespace ns2 { void f...
[7 replies] Last: Geared more toward... (by George P)
Unexpected behavior!
Consider the code below: using namespace std; int max(double a,double b) { cout << "You won't see me" << endl; return (a<b)?b:a; } int m...
[8 replies] Last: Hi You should make a habit of putting your own code in it's own names... (by TheIdeasMan)
by Geckoo
cast a value
Hello. According to the next code, it seems that we have two alternatives in order to cast a value. But which one is the best practice? #include <iostream> ...
[16 replies] Last: That is actually a good point — and a point of confusion to the unwa... (by Duthomhas)
Char array to dynamic char array
I have an assignment question that requests that i take my code where i have declared a normal char array and change it to a dynamic char array but when my code...
[19 replies] Last: // for ( ... (by JLBorges)
Program with dynamic char array just skips past function call
This is an assignment question, i had to include a dynamic array in the below program. Since i have included the dynamic char array it skips past the function c...
[15 replies] Last: [see also ] (by seeplus)
How to compile C++ 20 Modules Program using Visual C++ 2022 please
Following Visual C++ 2022 C++ 20 modules example program from C++ Professional 5th edition by Marc is giving following error: C7612 Couldnot find header iostre...
[6 replies] Last: M'ok, let me give you an example of what I mean, an example from the "... (by George P)
Need Help Compiling GUI C Program using Visual C++ Please
I need help compiling open source G Predict Satellite Tracking C program using Visual C++ 2022 Community edition please. On Google, searched for Github Gpredic...
[8 replies] Last: Thank you so much, Duthomhas, for the detailed steps about installing ... (by AlexCantor)
Questions about types (1,2)
Hello, I spent 4 days trying to wrap my understanding about types, but It seems I am hitting a big fat wall of frustration. I used to know that char is not n...
[23 replies] Last: Understand. Thanks ++ (by Geckoo)
by Geckoo
Noobs' questions (1,2)
Hello. I would like to start a thread with some noobs' questions. I ask myself about these points, promising to myself to do some search, and finally I forget t...
[22 replies] Last: ADL works by having all the necessary stuff in scope . The trick is t... (by Duthomhas)
Insights into c++ code
Has anyone used C++ Insights and do you trust the GitHub code? It is pretty helpful that it can take a variadic and break it down to what the compiler is actual...
[14 replies] Last: Has anyone used C++ Insights I've used the on-line version on test... (by seeplus)
Streams and terminals!
In one of his answers @Peter87 wrote: Streams are often "buffered", meaning that instead of writing the output to the destination straight away they often stor...
[4 replies] Last: Note that whilst you might want explicit buffer flush for cout (eg std... (by seeplus)
How bool is stored in memory (1,2,3,4)
I got that int is stored like: 01000100 01000110 00101101 00110001 char like: 00110001 and double(4 bytes) like: 0 10001000 1000110 00101101 00110001 ...
[60 replies] Last: @Peter87, I will give you 5 stars for this reply))))) And with even m... (by ninja01)
Pages: 1234
  Archived months: [aug2022]

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