Beginners

by admin
Welcome -- read before posting!
 
Welcome to the beginner's forum in C++.com! In this forum, users can to talk about any topic related to C++ for non-expert audiences. Feel free to participate...
[2 replies] Last: How To Answer Questions in a Helpful Way Be gentle. Problem-relat... (by admin)
Console Closing Down (1,2,3,4,5,6,7)
 
Hi, i am new to C++ and have just written my "Hello World" program. It worked all right but the console/cmd closes down instantly. If you tell me why it is clos...
[120 replies] Last: It displayed "Hello world" after you pressed Enter. int c is a ... (by Duthomhas)
C++ Questions (1,2,3,4)
 
1) Why does "&myChar " act differently in 2 different contexts? char* pointer = &myChar ; //ALSO WORKS!!! Above, it actually return the address of ...
[68 replies] Last: Protected/private inheritance is all about what access the derived cla... (by seeplus)
Visual studio keep aligning assignment operator
 
Hi, I want to turn off this type of formatting someLongVariable = false; shortVar = true; I prefer this someLongVariable = f...
[no replies]
by Mif
C programming / Program is Crushing when in release
 
I got this Unhandled exception when I try to run my program in release mod. I don't know what am I doing wrong, and I can't find where I'm exceeded the array bo...
[12 replies] Last: Also here sortAndFindMax(propValue, 5); I'm sorting the array and th... (by Mif)
Looking for tutor for OOP class
 
Hi everyone, I dont know if this is the right channel to ask this but im starting to fall behind pretty hard in my OOP class, I really need to catch up on a cou...
[2 replies] Last: For a different take on your lecture notes, have a look at: https://ww... (by seeplus)
Linking problem with qrcodegencpp [Linux]
 
Installing a new library and future its compilation is always pain for me. I've just installed simple lib: https://www.nayuki.io/page/qr-code-generator-library...
[4 replies] Last: >> /usr/lib/x86_64-linux-gnu/libqrcodegencpp.so.1 > This one looks lik... (by keskiverto)
Pointer to array in 2d array
 
Hi folks. I have certain function (in .cpp source) that takes a pointer to an array of 8 integer values. (The function is responsible for creating a Minor - ter...
[6 replies] Last: Ah, yes, you ran into magic VLA stuff. Fix that by cranking up your c... (by Duthomhas)
Git questions
 
Hi. Can I ask here git questions?
[2 replies] Last: That git-scm website has lots of git flavors for the 3 big OSes. If y... (by George P)
Container questions (1,2,3)
 
Just read and practiced my vector/deque/list/forward_list/set/multiset containers and I wondered about this one. 1) Why did they make it so that a set is REQ...
[51 replies] Last: A compile time check would be one of the NP complete problems I believ... (by jonnin)
Shared variable between thread(ISR) and main()
 
Hello folks, I want to create a variable that will be shared between a thread (ISR) and main() I am working on embedded environment on linux os Basically...
[8 replies] Last: Second, I learned about circular buffer. I wonder if it is suitable ... (by kigar64551)
by Ch1156
Collision detection using bit manipulation
 
So while working on a small game I discovered that the usual if statements for collision detection work fine for single directions, but when I had collision in ...
[12 replies] Last: Using bool and simplified, consider: #include <iostream> #include <... (by seeplus)
Confused about dangling pointers on a parent-child class
 
I am trying to understand dangling pointers using a Base Class and a Derived Class. #include <iostream> // Base class class BaseClass { private: pr...
[15 replies] Last: A reference can also dangle for the same reason, the object referred t... (by George P)
sizeof(integers)/sizeof(integers[0]) on vector<int> (x64) (1,2)
 
sizeof(integers)/sizeof(integers ) On x86 this works just fine, but on x64 the vector seems to reserve a long long (8 bytes) for each element but only uses ...
[22 replies] Last: IMO using != no matter what the layout of the container might be mak... (by SubZeroWins)
Operator overloading (1,2,3)
 
I am trying to understand operating overloading a bit better and I have 2 questions. 1)Why do we need a return of Date& in this part that is by the book? ...
[42 replies] Last: Oh, I thought they were the same thing. A null terminated character = ... (by SubZeroWins)
Vector of struct vs. two 1D vectors (1,2,3)
 
Greetings, I received the prototype of a simulation code from a colleague for a bunch of particles in two dimensions (x and y coordinates), and I went and impr...
[44 replies] Last: Thanks mbozzi for the interesting reference and your prototyped implem... (by PhysicsIsFun)
OpenMP to compute PI
 
Greetings, I am working my way into OpenMP. The following code is supposed to compute pi. It works fine for one thread, but in case of multiple threads the re...
[9 replies] Last: Thanks mbozzi, I understand! (by PhysicsIsFun)
by jNc
improve logger function
 
void writeToLog(){ string fileName = "/home/j/s/textFiles/logMPU.txt"; string line = ""; int lines = 0; ifstream file(fileName.c_str()); string d_txtFil...
[7 replies] Last: Much depends, of course, on the usage of the logger and it's required ... (by seeplus)
Cstring program not executing
 
Hello, Can anyone please guide what is wrong with my program. copied from a book I recently purchased and tried in code blocks. The terminal opens and I tyoe bu...
[10 replies] Last: I know more than a few GeeksForGeeks C++ code examples are big steamin... (by George P)
getchar and print c
 
hallo, a starters qwestion i wand to get char from the terminal window, but get a gcc error compiling it. ......................................... test...
[3 replies] Last: i wand to get char from the terminal window Note that whilst getcha... (by seeplus)
  Archived months: [jan2024]