Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
88 views

set Member Function Implementation for Image in C++

This is a follow-up question for draw_if_possible Template Function Implementation for Image in C++. In G. Sliepen's answer, set member function has been mentioned. ...
JimmyHu's user avatar
  • 5,510
4 votes
1 answer
66 views

Implementing Intersections data structure that is able to hold a container of multiple types that maintains order in C++

I am trying to implement a way to store intersections of rays with arbitrary objects. So far I thought I could make the object derived from an interface and put that as the type in the Intersection ...
Zcahfuz's user avatar
  • 41
6 votes
3 answers
1k views

Simple Container Class

I'm learning C++ and trying to create my own container class just for practice (I know about vector, list, map, set). I plan to improve this class and add new methods as I learn new material. Please ...
vansergh's user avatar
  • 161
4 votes
1 answer
87 views

Terminal based game: Part 3 (Using templated game)

Working from previous posts In this post: Terminal based game: Part 2 I introduced the concept of a Game object. To build a game like Terminal Base Snake you could ...
Loki Astari's user avatar
  • 96.6k
1 vote
1 answer
114 views

An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++

This is a follow-up question for Multi-dimensional Image Data Structure with Variadic Template Functions in C++. Considering the suggestion from G. Sliepen: Make everything work for more than 5 ...
JimmyHu's user avatar
  • 5,510
5 votes
1 answer
294 views

Multi-dimensional Image Data Structure with Variadic Template Functions in C++

This is a follow-up question for Three dimensional data structure in C++. I am trying to implement multi-dimensional image data structure with variadic template functions. For example, ...
JimmyHu's user avatar
  • 5,510
5 votes
2 answers
840 views

Three dimensional data structure in C++

This is a follow-up question for Three dimensional gaussian image generator in C++. Considering the suggestion from G. Sliepen: Structure of a 3D image Your 2D ...
JimmyHu's user avatar
  • 5,510
3 votes
2 answers
126 views

Defining hardware components structure

I'm writing firmware for my Arduino project, and I'm struggling with a clean, scalable hardware mapping structure. Initially, I had the following namespace: ...
Dead1nside's user avatar
7 votes
3 answers
209 views

C++ String Class Reimplementation

I started learning C++ about a week ago and I was hoping somebody can critique my code. I decided to implement my own basic String class just for the sake of applying all that I've learned about ...
Janriz Libres's user avatar
-4 votes
1 answer
86 views

any bits unsigned integer [closed]

This is a class that acts as an unsigned integer with a variable amount of bits. ...
RhinoRunner's user avatar
1 vote
2 answers
151 views

A simple String class and its special member functions

I am learning the behavior of C++'s special member function, using a naive String class as example. (The code is modified from this tutorial) Here is the ...
Lion Lai's user avatar
  • 297
1 vote
1 answer
51 views

Sparse String Matrix Storage Class C++

Introduction I implemented a class to store a matrix with entries at positions (i,j) that are strings. The matrices I would like to efficiently store in this class have strings as entries and it ...
jan0155's user avatar
  • 113
1 vote
1 answer
176 views

A greedy approach to the Knapsack problem with C++ templates

The assignment is to be implemented on the following instructions: You are to write a Knapsack class and the main() to support and demonstrate the functionality required here. A function generate(int)...
user avatar
0 votes
1 answer
524 views

What can I do better in my C++ serialization implementation?

I want to serialize a class Mango recursively. ...
James_sheford's user avatar
2 votes
2 answers
333 views

Template Complex class

I have created a class Complex which represents a complex number of any arbitrary arithmetic type. Overloads are given for the 4 common functions, addition, ...
finlay morrison's user avatar
3 votes
1 answer
241 views

Topological Sort C++

Comments on optimizing the code or improving the code are requested. The input parameters to the class constructor are a one dimensional array of job ID's and the second argument is a list of vectors ...
return_of_the_kin's user avatar
2 votes
1 answer
119 views

UpdateCustomer - implementation in C++

I am trying to write a program that does the following: The application will read the customer and book orders data from a data file “BookOrders.txt” and load them in a customer linked list, each ...
jr.çhåvez__07's user avatar
1 vote
1 answer
202 views

ASCII game in console [closed]

Overall, I want to make a game in console, something Pokemon-like but with typical rpg scenery - swords, magic and all that. I want to make player able to move around the map, find dungeons, fight ...
supermaciu's user avatar
10 votes
1 answer
928 views

High performance physics simulation - core class design

Below is some stripped down code from a physics simulation. The classes Vector2, Line and ...
Oliver Schönrock's user avatar
4 votes
2 answers
1k views

Contact management system

I have created a contact management class for practicing, and I want to know your opinion about it. I know there are a lot of example of contact management class, but I tried to make this one a bit ...
meysamimani's user avatar
2 votes
2 answers
692 views

Checking image size in C++

This is a follow-up question for 3D Inverse Discrete Cosine Transformation Implementation in C++. After checking G. Sliepen's answer, I am trying to update the part of width and height checking of <...
JimmyHu's user avatar
  • 5,510
6 votes
5 answers
2k views

TString - An implementation of std::string

I wanted to make a feature rich string in C++. Similar to one in python. I am using C++14. I have not added much yet, I just want to get my code reviewed to ensure I am going the right way. Features: ...
Random_Pythoneer59's user avatar
4 votes
3 answers
1k views

C++ Vector3d class

As part of a physics simulation written in C++ using SFML I needed a vector3d class. Here is my implementation: ...
Oliver Schönrock's user avatar
4 votes
2 answers
541 views

C++ simple 2D vector

I'm brand new to cpp and tried implementing a simple Vector class that supports abs(), equality and addition operators. I just wanted a quick set of eyes to tell me if I'm doing anything egregious in ...
Alexis Drakopoulos's user avatar
4 votes
3 answers
244 views

Barebones C++ Matrix class

I have implemented a C++ Matrix class using std::vector and a number for rows/cols. The implementation works decently from the QA I've done. I have implemented a Vector class as a derived class but I'...
LOLcat_enjoyer's user avatar
2 votes
1 answer
205 views

Operator overloading in Image class implementation in C++

This is a follow-up question for Dictionary based non-local mean implementation in C++. There are some issues about operators (operator+ and ...
JimmyHu's user avatar
  • 5,510
2 votes
1 answer
132 views

Gallery template class

I have created a template class Gallery which is intended to be used as a container for objects. I used a private member of type...
Shwalala's user avatar
4 votes
4 answers
6k views

Tic Tac Toe in C++ with classes

My first language is Python and I learned considerably a good amount of it. So now I started learning C++. I know the basics of C++ and about classes and inheritance. This is my first serious project ...
Random_Pythoneer59's user avatar
2 votes
1 answer
110 views

Tests for the operators of image template class in C++

This is a follow-up question for Two dimensional gaussian image generator in C++. Thanks for Cris Luengo's answer and JDługosz's answer. I am attempting to update the implementation of ...
JimmyHu's user avatar
  • 5,510
-1 votes
1 answer
44 views

c++ program with 2 classes [closed]

Im making this project from few days , and now i need little help because i am struggling. The task says II. Define a student booklet class CStudBook that inherits CStudent with a member data ...
user16060425's user avatar
1 vote
1 answer
414 views

OpenGL mesh class and derived primitive class

Introduction After finishing most of the tutorials on https://learnopengl.com/ I started to encapsulate code in their respective classes and started to write a mesh class and a polygon class as my ...
Christian Ivicevic's user avatar
2 votes
1 answer
90 views

Multiply a square matrix with only the diagonal and antidiagonal elements different from zero in vector [closed]

So I have a square matrix with the diagonal and antidiagonal elements different from zero in a vector vector<int> matrix = {1,2,3,4,5,6,7,8}; The matrix: <...
user14711505's user avatar
0 votes
2 answers
1k views

Inventory system/management

Just wondering how my code looks, consider it a "professors input" since I'm not taking classes this semester. Also I'd like to note that this will soon be transitioning to a database ...
CrypticEthos's user avatar
2 votes
1 answer
95 views

An Implementation of Two Dimensional Plane as Monochromic Image Container with std::unique_ptr in C++

I am trying to implement a monochromic image container with std::unique_ptr. The example usages The example usages is as below. ...
JimmyHu's user avatar
  • 5,510
4 votes
1 answer
507 views

C++ Queue Circular Array Implementation

I'm trying to implement a queue data structure in C++ using a circular array. Please give recommendations on how I can improve this code. Also, is my array growth strategy good? I'm doubling the array ...
Guy on the Internet's user avatar
0 votes
1 answer
806 views

Library Management System with OOP [closed]

I am creating a library management system. Presently am done creating the Book and BookItem class. Can you point any thing you feel isn't necessary, inefficient or a general bad practice so I could ...
theProgrammer's user avatar
2 votes
1 answer
941 views

Generic Doubly Linked-list implementation in C++

I am just learning about C++ templates and generic types, I decided it would be nice to try to create a generic container class as a challenge and test my knowledge in the process. Here is what I have ...
user avatar
4 votes
0 answers
65 views

Creating a C++ style class for storing a data on 2D grid on GPU memory

UPDATED I would like to create a class, which is intended to represent a field of values on a 2D grid. So, I would like to access the elements with a double square bracket ...
spiridon_the_sun_rotator's user avatar
1 vote
1 answer
284 views

Json config loader class

Currently the class takes a json file and retrieves data from it, and i'd like to improve this class. ConfigLoader.h ...
Nadpher's user avatar
  • 909
5 votes
1 answer
3k views

chess game Class

Here is the chess class for my very own chess game. Everything is in this class. Generating moves, getting a move from the computer, printing the board etc etc. This is a follow up question to C++ ...
user avatar
3 votes
1 answer
1k views

Banking system using polymorphism

I am asking this, because after studying I am confused that it is necessary to declare base class object, then declare derived class object and then store reference of derived class object in base ...
BilalMohib's user avatar
4 votes
1 answer
279 views

C++ Dynamic Array Class Testing

I'm creating a basic Dynamic Array class in C++, and I'd like to know if there are any bugs/memory leaks I haven't noticed yet. dyn_arr.h : ...
DarkoNaito_09's user avatar
6 votes
2 answers
2k views

Simple Multiclass C++ Project

So I'm working through a beginners C++ book and they had this example demonstrating class hierarchy, which was originally in a single file. I tried recreating it with multiple files (header files + ...
avghdev's user avatar
  • 135
2 votes
3 answers
113 views

Socket library based on winsock

I wrote a socket library in C++, to wrap Winsock. I found it a bit tiring using winsock2 - I'd say it's a bit complex, compared to, for instance, the Python socket library. My code, header file: ...
SunnyJ's user avatar
  • 21
6 votes
5 answers
27k views

Date class in C++

This is a Date class in C++. I didn't use C++ strings because I'm not sure if I'm allowed to. It seems to work fine, but I'm wondering if there are any errors I ...
user avatar
6 votes
2 answers
8k views

Basic String class

I wanted to create a basic String class that will hold a CString and have: constructor, destructor, copy constructor ...
yaloner's user avatar
  • 295
7 votes
2 answers
5k views

Use of a static class for a game engine

I've been designing a game engine for the past few months with little issues. However, one main goal with this project is to put it on my portfolio/résumé so naturally I want the code to be as good ...
heyufool1's user avatar
5 votes
1 answer
5k views

Wrap function pointers in template classes

I'm working on a C++ library for Arduino and other embedded systems. I'm currently working on wrapping up function pointers and member-function pointers into two C++ template classes (function and ...
Nathan Wehr's user avatar
5 votes
2 answers
10k views

User-defined class for a box

We have just learned about classes. Please help me improve this program. I created a class called Box with members that represent its dimensions. Then I calculate ...
user avatar
5 votes
1 answer
104 views

Architecture for manager that gets shared among different components

It started with a simple log manager. Then I wanted to implement more features, for example printing the name of the component that send a message. Later on, I can think of giving each component that ...
danijar's user avatar
  • 205