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)
Span Vs Vector
 
I occasionally tune into "C++ Weekly" on Youtube, and this is today's video: https://www.youtube.com/watch?v=zCzD9uSDI8c "C++ Weekly - Ep 361 - Is A Better `ma...
[1 reply] : 1) A span isn't a replacement for a vector in general. A vector store... (by jonnin)
is this ok as a less than operator for a map?
 
I have a map of the following type: struct MyType { size_t layerPos, posInLayer, prevPos; }; std::map<MyType, string> myMap; std:...
[3 replies] Last: struct MyType { std::size_t layerPos = 0 ; std::size_t posInL... (by JLBorges)
Reading unkown number of bytes from a non-blocking socket
 
Hi, I am trying to learn C++ and my first project is to convert a Basex Client I wrote in R to a C++ client. From the earlier experiences, I know that I hav...
[19 replies] Last: @kbw With copy-paste I was able to fit the custom readSocket function ... (by Bengbers)
keep getting error
 
keep getting an error, not sure what im doing wrong. I'm running it on visual studio Microsoft. The main errors I'm getting is "argument of type "const char *" ...
[12 replies] Last: > violating a suggested guideline It is a rule; not a mere guideline ... (by JLBorges)
by Ch1156
Should smart pointers be preferred over new and delete keywords?
 
Im on chapter 11.9 of learncpp and i see that its going to be teaching about using new and delete, but i heard its better to use smart pointers instead. I can u...
[2 replies] Last: At least do the basics. An hour or two of your time will help a lot w... (by jonnin)
by Mif
length of the array of pointers, using strlen in C
 
Hello.. How do I find the length of this array of pointers? char *gCreditsEn = { "Title", "Game created by:", "Game Design:", "Music by:", "...
[16 replies] Last: Sure, but strlen expresses intent better. (by Ganado)
by anup30
print the content of your program's source file to console, without user inputting the file name or giving it in source.
 
print the content of your program's source file to console, without user inputting the file name or giving it in source. the main problem here is getting the...
[11 replies] Last: If it had ^^ instead of ^^^ teeth I would a vampire but I hope JLBorge... (by malibor)
Why is cin not working after loop?
 
Hi everyone! so I have an issue I cannot figure out, basically when I simulate eof using ctrl + d the second use of cin is never used and skipped over, I have a...
[3 replies] Last: Thanks seeplus for the help with this! I really like the idea of using... (by Dakiller)
Be careful when storing the result of std::clamp as a reference
 
Earlier, someone posted a question about std::clamp but the thread was removed before I had a chance to respond (probably because the OP realized his mistake). ...
[12 replies] Last: Some structs are PODs. (by Peter87)
Stack frame error
 
Hi. I ask couple of days ago about unexplained code behavior. It hasn't been solved completely. I now have some more specific details about that. Function In...
[15 replies] Last: Hi folks. I have an update about the issue. in sitalDevice_Initialize... (by Jonathan100)
Was std::set suppose to model mathematical sets?
 
I apologize in advance. This reads like a half-rant/half-question trying to understand why C++ was designed a certain way. std::set seems redundant and beha...
[5 replies] Last: It depends on your perspective, I suppose. in short to the above, no... (by jonnin)
Looking for guidance on writing desktop apps
 
Hi People, I want to write some desktop apps. I have some good ideas. However, I have become very aggravated with current book offerings. I have 2 books on C++....
[11 replies] Last: > I also do not have a problem with learning C# and .net. >> I would ... (by JLBorges)
Finding Vector(includes objects) Element's Index by Element
 
I'm trying to find the index of a vector element. Vector includes class objects. But I can't find a way. #include <vector> #include <algorithm> #include...
[2 replies] Last: Perhaps this: #include <vector> #include <algorithm> #include <iost... (by seeplus)
Size of Union and Struct
 
Hello, I want to calculate the size of struct and union. Is the below true? In the union, the output is 20, I expected being 24 (20 is size and 4 for paddin...
[14 replies] Last: Worth noting that standard C++ has alignas for controlling alignment... (by mbozzi)
Inheritance and virtual functions
 
Greetings! I try to understand the role of the virtual keyword when changing the signature of a member function in a derived class compared to a base class (I ...
[9 replies] Last: Thank you guys! (by PhysicsIsFun)
Returning wrong value
 
Write your question here. In function Sum why is program returning an 8 in sizeof(A) instead of 4? Int*P points to first element in array A which is an inte...
[8 replies] Last: For typical values, std::ptrdiff_t can be used as signed std::size_... (by JLBorges)
by Ch1156
How to output a map from a class with operator overloading (1,2,3,4)
 
So im trying to output the contents of a map from the class and i obviously have to overload the << operator to do so but i cant seem to figure out what im dong...
[77 replies] Last: Yow, that there is one mouthful. (by George P)
How Can I Initialize this Dynamic array?
 
Hello, How Can I Initialize this Dynamic array? I'd like to have pointer to an array with size n int *arr #include<iostream> using namespace s...
[3 replies] Last: If you are wanting to have a dynamic array why bother with pointers, e... (by George P)
Pages: 1234
  Archived months: [nov2022]