Beginners - December 2022 (Page 2)

Compile Errors of Substring Sort Program
 
Need help in fixing compile errors using VS2022 please: Error (active) E0757 variable "size_t" is not a type name ucrt\corecrt_memory.h 38 Need help in updati...
[6 replies] Last: As a first refactor (keeping char* instead of using std::string), poss... (by seeplus)
C++ Design Pattern
 
How to fix compile errors with VS2022 please? Following programs are from Professional C++ 5th edition by Marc Gregoire. Error C2653 'Logger': is not a class...
[2 replies] Last: Thank you AbstractionAnon. Fixed the import & exports correctly. And t... (by AlexCantor)
Help me with my first OO project
 
Hi everyone, I started working on my first "real" object-oriented project. It is supposed to be a tool that allows me to easily perform various experiments i...
[7 replies] Last: A suggestion when dealing with a lot of code (a lot is a relative term... (by deleted account xyzzy)
Unable to access elements of vector<vector<?>>
 
I have this class where the only atribute is a vector<vector<?>> like this: class Test { private: vector<vector<struct Pixel>> pixels public: ... } to...
[10 replies] Last: [quote=LtL]Every time you found some unexpected errors or sth., give y... (by Peter87)
compiler warning about class with no virtual constructor when there is one
 
I have this base class class Netpbm { protected: char magicNumber; int width; int height; Matrix<pixel> * pixels; public: ... virtual ~N...
[17 replies] Last: [see reply to https://cplusplus.com/forum/beginner/285133/ ] (by seeplus)
Code compiles without errors or warnings, but execution gives segmentation fault error in some cases
 
The code below is a short version of the project I am implement right now, which is a executable (https://github.com/klebermo/game) and a library (https://githu...
[10 replies] Last: With this suggested code, I still got the same error, but now with th... (by seeplus)
std::bad_alloc for merge sort
 
For merge sorts I've been dealing with this error for quite sometime and cannot figure out how to solve the memory leak issue. Solutions would be great! #i...
[2 replies] Last: I've been dealing with this error for quite sometime and cannot figur... (by seeplus)
discrete distribution
 
I'm familiar with discrete and weighted distributions,I just can't seem to figure out how to do what I need... I need to be able to pick a random item from a ve...
[8 replies] Last: Yeah, std::random_device was broken in some old versions of MinGW. Yo... (by Peter87)
unknown type name error in Vitis
 
Hi folks. i works on Vitis environment which is based on eclipse. I have very complex code, with .c file and headers. sometimes it is compiling and sometim...
[11 replies] Last: Thanks guys appreciate 🙏 (by Jonathan100)
First use of template for array type
 
Windows 11, Visual Studio 2022, C++ This is my first attempt at a template. It will compare two arrays of type uint8_t, uint16_t, uint32_t, or uint64_t. And ...
[4 replies] Last: I don't know how the VS debugger works but perhaps you where stepping ... (by Peter87)
Need help in fixing include .h file
 
I am trying to compile couple of Functional C++ programs using Ranges feature from the following book: Functional Programming in C++ by Ivan Cukic, Manning Publ...
[5 replies] Last: Is GCC version you have used 12.2 released on Aug 19, 2022 ? No. It'... (by Peter87)
Supply a vector input with uint8_t array
 
Windows 11, Visual Studio 2022, C++ I know basic C/C++ but not vectors. I found code that does base58 encoding. The function is declared as: std::string ...
[3 replies] Last: I did not know that I wanted a vector of vectors, but that does work. ... (by bkelly13)
class atributes being corrupted after initialization of object
 
I have trying implement this class class Bitmap : public Netpbm , where the subclass Bitmap has a read_file method which read data from a file (to atributes ...
[9 replies] Last: As a first refactor, consider (NOT tried): #include <algorithm> #in... (by seeplus)
C++ vs MATLAB for loops syntax
 
I was trying to use the function rand() in C++ to reproduce some for loop results from MATLAB. Are these to for loops in MATLAB and C++ identical? Or I guess ho...
[8 replies] Last: ouch, twice I have looked at that and took it to be some C extension i... (by jonnin)
Getting weird output when trying to pull info from file and then display it on screen
 
As the title says I am trying to pull info from a file, calculate GPA with file info, and display it on screen. I keep getting this weird output (below) and it ...
[3 replies] Last: You haven't provided a sample file input so I can't easily test, but c... (by seeplus)
isdigit not working with map
 
So my program runs... kind of. If I assume the user inputs an integer it works fine, however if they input a char or anything else really, the whole program wil...
[9 replies] Last: It's often useful to have a function that displays a prompt and obtain... (by seeplus)
December 2022 Pages: 12
  Archived months: [nov2022] [jan2023]

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