Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
16 votes
4 answers
39k views

Card and Deck classes

I would like to know whether I'm going in a correct way or not in building my Poker game. So far, I've implemented card and deck classes and I would like to see your feedback about my work. Feel free ...
CroCo's user avatar
  • 504
14 votes
4 answers
94k views

C++ Student Class

Is this a good approach of designing a class or is there some other way that I am not aware of? Student.h specification file ...
Deepak Singh's user avatar
13 votes
4 answers
52k views

Text-based RPG game using classes

I am studying for a degree in "Bachelor of Engineering in Information and Communication Technologies." I am currently on vacation, just after we started learning C++ at the end of the semester. I ...
Sumsar1812's user avatar
12 votes
6 answers
1k views

Class for holding person's information

I have written another program in C++. Excluding the point that the class definition should be in a separate header file, is there anything that needs to be improved? ...
user avatar
12 votes
2 answers
20k views

Tree Template Class Implementation for C++

I have not done any parameter checking, however I think the meat of the class is there. Let me know what you think. ...
Joe's user avatar
  • 123
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
9 votes
1 answer
17k views

Review of 2d Vector class

I'll keep this short. I've never actually done professional C++. I don't really know any of the 'best practices'. I'd like to get some review on a simple class that I've made. My Vector2d.h file: <...
Tyler Slabinski's user avatar
8 votes
3 answers
1k views

Is this Date class well-written?

I'm a C++ beginner and have made a simple class. But I'm not sure if this is well-written. It's basically just a Date class. ...
Normal People Scare Me's user avatar
8 votes
2 answers
1k views

C-style array class

I often use C API's in C++ that force me to use C-style arrays. I got sick of constantly using a dynamic vector with &vec[0], so I wrote this C-style array ...
orlp's user avatar
  • 391
8 votes
1 answer
216 views

Simplifying a Resizing Method

I'm making a simple container class for fun and education, but my rebuilding/resizing method seems rather inefficient. Is there an easier way to do this? ...
Maxpm's user avatar
  • 395
8 votes
1 answer
4k views

Creating C++ classes and objects

I'm brand new to programming (in general) and C++ (in particular). I'm learning the basics of classes and objects. I'm trying to do the following: Create a class called ...
user3814362's user avatar
7 votes
4 answers
3k views

Testing parity of number of items

This is my first C++ program with classes, and I don't want to develop bad skills. It's very simple and consists of 3 files. This is an exercise from a book, hence the name of the driver file. ...
mitya221's user avatar
  • 793
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
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
7 votes
2 answers
6k views

Playing cards in C++

I am currently learning C++ (note: I am using C++11) and have begun working on a small project to practice what I've been learning. This project is a deck of cards that I hope to use later to create ...
kamek's user avatar
  • 173
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
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
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
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
6 votes
3 answers
457 views

Deck and Card classes and member-accessing with one header

Previous review of this project: Card Deck class for a Poker game - version 2 This time, I considered combining both classes into one header file so that I can reduce my use of ...
Jamal's user avatar
  • 34.9k
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
5 votes
2 answers
5k views

STL-like graph implementation

I have implemented an STL-like graph class. Could someone review it and tell me things that I could add to it? File graph.hpp ...
Rondogiannis Aristophanes's user avatar
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
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
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
5 votes
1 answer
463 views

Simplifying member functions in Blackjack game

For my display functions in my Blackjack game, I want to control each player's stats output based on whether a turn is in progress or has ended. Normally, you could only see one card that your ...
Jamal's user avatar
  • 34.9k
5 votes
1 answer
3k views

Simple Socket class hierarchy

One of the things I wanted to do was make it impossible to forget to initialise or forget to cleanup WSA. Often the network examples will return as soon as an error occurs (say an socket didn't bind) ...
Borgleader'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
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
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
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
4 votes
2 answers
955 views

Console class that handles multiple buffers

I'm working on a 80x25 terminal that splits the screen into two. The top half gets the first buffer, the bottom half gets the second buffer. I'm concerned about readability and accessibility. For ...
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
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
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
4 votes
1 answer
263 views

Nested Deck class design and implementation

Previous review of this project: Deck and Card classes and member-accessing with one header I'm nearly finished with my deck of cards project, and this time I made changes to hide the ...
Jamal's user avatar
  • 34.9k
4 votes
3 answers
2k views

Static class member destruction in C++

I have a basic cache set up. Whenever a user requests a bitmap, it fetches or loads it from disk if it isn't already loaded, significantly reducing load times. Currently, the design explicitly tells ...
Casey's user avatar
  • 748
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
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
4 votes
1 answer
571 views

Did I convert this C++ class to Common Lisp correctly?

Here is the original C++ class I converted to Lisp at the very bottom of this post. ...
Edward Monney's user avatar
4 votes
1 answer
706 views

Shader class implementation

I'm trying to design a Shader class. For now, I'm just trying to get basic outline for handling uniforms. Some design goals I aimed for is to avoid passing a ...
skln's user avatar
  • 141
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
3 votes
4 answers
1k views

Card Deck class for a Poker game - version 2

This code was first critiqued here (without the Card class): Card Deck class for a Poker game After learning more about data structures both online and in class, I wanted to revisit my ...
Jamal's user avatar
  • 34.9k
3 votes
2 answers
8k views

Calculating Julian dates

Refactor this code so that I don't have to insert the parameters any time I need to use one of the functions. I have a class, say julian, for calculating Julian ...
Tomoyose's user avatar
3 votes
2 answers
5k views

Validating C++ Time class objects

I created a Time class. Now I want to modify the code to perform input validation. Hour should be between 0-24, minutes and seconds between 0-59. If class need ...
Deepak Singh's user avatar
3 votes
3 answers
507 views

Simple class exercise using the "this" pointer

This is my solution for an exercise from a book. It's a simple Golf class with member variables fullname and ...
mitya221's user avatar
  • 793
3 votes
2 answers
779 views

Image loader/writer design (no API, pure C++ on Windows)

I have an image loader, now only for bitmaps. I'm a little confused because I want to split my code to different classes, one for writing a BMP data to a file (WRITER), one for loading BMP data from ...
David Szalai's user avatar