General C++ Programming - January 2021 (Page 2)

by MS35
Additional C++ Help
 
Hi everyone, I am currently attempting and trying to familiarize myself with c++. I am very new and trying my best with online research and videos. I am curr...
[5 replies] Last: Thank you guys! I have an idea on what to do, thanks for the hints. I ... (by MS35)
Read file from second line
 
Hi, I have a file that contain data about student. File contain in this order 1.name of student 2.id 3.average In the first line of the text I have a number th...
[1 reply] : >> leaves the trailing newline that the following getline() obtains as... (by seeplus)
by frek
Move constructor/assignment operator
 
A move cotr/assignment optr is called when there's an rvalue reference (a temporary object) assigned to an lvalue. For instance I've defined my move semantics t...
[4 replies] Last: the move constrcutor is not called! Yes, this is commonly known as "c... (by coder777)
by frek
Smart pointers proper usage in a simple program
 
Hi, The following is a theoretical project whereby I struggle to get through the challenge of ambiguity of using smart pointers correctly! #include <iost...
[6 replies] Last: > Which one should I use for this project and why You should not be u... (by JLBorges)
by PeteDD
Constructing class objects using names from an array
 
Is there a way to construct class objects by using names which are stored in an array as the names of the objects. Here is it conceptually but this throws a c...
[7 replies] Last: Blindly ignoring the costs of a.) writing code that does nothing; and... (by mbozzi)
by mpg
g++ codice.cpp -L dependencies \lib -lpq -o codice
 
I use PostgreSQL. I write in the terminal: g++ codice.cpp -L dependencies\lib -lpq -o codice but I have this: g++: error: codice.cpp: No such file or direct...
[1 reply] : What does ls print? ..or dir, if vanilla Windows (by Ganado)
by Ocko91
Mega milions
 
Hi there; I want to make program that show me ,how long I need to wait for my lucky day. I want to select only 1 combination ,let say numbers 15,25,35,45,55 . P...
[4 replies] Last: You've misunderstood the question. He wants to simulate playing the sa... (by dutch)
IF Statement
 
I want to make a program that asks the user to type "HI". But when that it is stored in the variable. I want to make an IF statement that does, if the variable ...
[1 reply] : and what part of this requirement don't you understand/am having diffi... (by seeplus)
by frek
std::string or std::string_view
 
Hi all, I found this interesting thread: http://www.cplusplus.com/forum/beginner/240488/#msg1070623 where mbozzi said: Really, the choice depends on the sema...
[7 replies] Last: > So for anything that's using an std::string_view we must pay enough ... (by JLBorges)
by gwbots
Steam Proton (Linux) and Reverse Engineering Question (General + Noobish)
 
I'm trying to run a old Windows game and its companion tool (user-created) under Linux. Since the game can already run on Steam Proton (Linux), I'd like to kn...
[1 reply] : you can just try it but it may not work at all, depending on what it d... (by jonnin)
by fjl
Parametric Polymorphism and References
 
I get the feeling that this is a bad idea in C++, but before I abandon trying to make it work and go back to pointers and dereferencing (which work just fine) I...
[3 replies] Last: > Do you, perchance, have chapter and verse on it? The gory details a... (by JLBorges)
by frek
Range-based for on std::vector
 
Hi, Can't we define auto so that it provides us with an iterator to the elements of the STL container as in the code below? int main() { std::vector<in...
[2 replies] Last: Thank you for your answer. (by frek)
by frek
Copy assignment definition for a user-defined type
 
Good day guys, Is the implementation for the assignment operator below correct, please? If not, why? class Vector { private: double* elem; // elem points ...
[7 replies] Last: > if we defined the operator the following way what would be the probl... (by JLBorges)
by frek
Code review
 
Hi devs, I've got an old code of mine (pertaining to a slightly long time ago that I've forgotten most of it!). Tried to polish it with C++ modern stuff as muc...
[16 replies] Last: Guys, the issue about that if statement is arguably easy! My bad! ln-... (by frek)
Printf '%e' expects type 'double' but argument 2 has type 'double *'
 
Hey! I am doing unit testing on my c++ code on VS code windows, however I am stuck with a simple issue. I am trying to print out the output of a test function ...
[3 replies] Last: The fftw_complex type holds a complex number as a 2-element array of d... (by dutch)
Conversion from COMPREAL to REAL and float
 
The following code is from a C file: venext.c. It is associated with the simulation software Vensim and helps compile C files into a DLL, for use by a simulatio...
[2 replies] Last: the pointer ones may actually break something. The first one is about... (by jonnin)
 
[1 reply] : float a ; a = distances_1 / distances_2 The last valid index ... (by thmm)
by de555
How do I get rid of , —, and other mystery characters?
 
I am trying to read a txt file but the output starts with "" and all of the long dashes are replaced with "—". I wasn't able to find an adequate s...
[4 replies] Last:  UTF-8 bytes: EF BB BF ZERO WIDTH NO-BREAK SPACE Hex code po... (by dutch)
by PacR
Change fast inverse square root to regular square root?
 
How to edit this code to get regualr square root instead of inverse square root? float q_qsqrt( float number) { long i; float x2,y; const ...
[2 replies] Last: Thank you jonnin. I used approximations that depend on the floating po... (by PacR)
How to draw 3d polygon maps without an editor?
 
Hey, I am working on a game engine and I am at the point of needing to understand how to draw 3D maps like this "https://fabiensanglard.net/quake2/soft_renderer...
[1 reply] : most engines import 3-d objects from an editor program; these are a lo... (by jonnin)
January 2021 Pages: 1234... 6
  Archived months: [dec2020] [feb2021]

This is an archived page. To post a new message, go to the current page.