r/learnprogramming • • 25d ago

project ideas for a ‘beginner’

so i’ve taken courses on C++ in the past and feel comfortable with topics as advanced as classes and have exposure to data structures and algorithms. what are some projects a ‘beginner’ like me could do to learn how to program C++ applications from scratch?

10 Upvotes

14 comments sorted by

3

u/that_1_actual_killer 25d ago

It’s crazy cuz it gets a lot of slander but a todo list. And not just calm one I mean pull all the stops. It was my first project and I learnt a lot. Hooked it up to so much stuff I learnt how to work with connectors, third party code and stuff. And you also have to think of nested lists and how those work. You may not do it all in one goal but just make a personal todo list you tweak and update. (My favourite thing in programming is object oriented programming so this may be why I loved this project a lot) but I think it’s really good

1

u/JackRyan13 25d ago

I just made one myself in javascript, though a shopping list but it's essentially the same concept. It took me 2 weeks tinkering here and there (not a student but someone that's interested in giving this a go) and it really tested me. I had all of my data as a basic string in a global array and basically the whole thing in 3 functions, add and amend the list element, delete and amend the list element, complete and amend the list element.

Then I discovered that you can protect that data so I rewrote it all to get rid of the globals, but then I had to rewrite how it renders the data because previously it amended the html when i mutated the array. which I faffed around with for a week. This shit's hard lol.

4

u/JackRyan13 25d ago

Make a shopping list or a randomiser or rock paper scissors game

2

u/Cautious-Skirt-8335 25d ago

Calculator, clock, pong clone

2

u/WhaleBird1776 25d ago

If you like card games those are fun to make imo. My first project was a blackjack game which over time I added things like betting, chip balances, and other games. Was fun

2

u/MarkoDahl54 25d ago

Make a simple text-based RPG or inventory system using only the STL and C++17 features, because sticking to standard library stuff avoids weird platform bugs and you'll really learn how classes and vectors work together.

2

u/h1warkar 25d ago

I’d say a good goal to target is building your own basic http server from scratch, so whatever goes for it from wherever you are

2

u/AdDiligent1688 25d ago edited 25d ago

build a binary logistic regression model with gradient descent and get it to predict on a binary classification data set. I know it sounds intimidating, but it’s not as bad as you might think.

start with getting it to work with a simple clean dataset, titanic is a good one. encode the data into numericals. Anything categorical, use low discrete value system (0 or 1, for two options). identify your dependent and independent variables, try to predict one column at a time. split the dataset into train and test, ignoring header row, with 80/20 or 60/40 (train/test) ratio. train the model on both independent and dependent. test on only independent. then measure if the test predictions are actually correct, using the actual dependent from test. calculate the accuracy, precision, specificity (look into ml definition of these).

training break down:

the binary logistic regression model accepts a linear combination, z=w•x+b. each w is the weight, x is the value of independent variable, and b is bias term. If you were predicting on survived, it could look like this: survived=w1•pclass+w2•fare+w3•sex+b. this example is using the “features” pclass, fare, and sex, in order to predict if a given passenger survived or not. The model takes in the result of this equation into the sigmoid function.

The sigmoid function, p=1/(1+e^(-z)), produces a probability between 0 and 1. The goal during training however is to have the weights of the model adjust so that they conform to the patterns in the training data. So with this probability, you optimize the weights further, using a simplified gradient descent equation by passing in p and y (dependent label 1 or 0) into: gradient=x•(p-y) where x is the value of the independent variable. You do this for all independent variables.

After this step, you use a weight update equation for the model, w=w-(gradient•lr), where lr is learning rate (10^(-5)< lr <=1). The learning rate controls the step size the model takes when updating its weights and bias (b). This is something you define, within the given boundary, and you can change this to increase the step size on your own. In addition to the weight update, you need one for bias: b=b-(lr•(p-y)), bias doesn’t have an independent variable associated with it in the linear equation, so the gradient doesn’t apply here.

When looping over your training data, each epoch, make sure to add up all the gradients and bias (error=p-z_actual) for the whole batch into temporary variables (total_dw, total_db) before applying the subtraction update (weight/bias) formulas. If you update w and b instantly on row 1, the model will use the corrupted new weights when it processes row 2. You don’t want to do that. You want to use batch gradient descent, update the weights / bias after each epoch using the total, w1 -= lr•(total_dw/N); where N is the amount of rows in the training data set, for each weight wi. Do the same for bias, b -= lr•(total_db/N) as well. You do both of these for each epoch.

The model trains through “epochs” which are complete passes through the entire training data set. This is necessary with gradient descent because optimization is an iterative process. An ML model cannot get everything correct on the first try, it must have multiple runs through the training data, to gradually refine its parameters.

You can stop here for training. The model will train just using the above. But if you’re up for it and you want to plot how your model gets better each epoch, you can look into binary cross entropy loss function, the simplified gradient descent formula provided is already derived from it. I’ll leave that to you to consider later.

testing break down:

once your model has been trained and the weights are updated, through gradient descent, then you can begin the testing phase. It is more simple.

The testing set is usually smaller than the training set, e.g. 80/20 (train/test) or 60/40 etc. This set is also divided between independent and dependent variables. You will use the same linear combination as the training, but this time, only show the model the independent variables, not the dependent. Pass the combination result into the sigmoid function, get a probability between 0 and 1. Then with this probability determine if it is 1 or 0 prediction via a simple conditional: y_pred= p>=0.5 ? 1: 0; that is, if the sigmoid output is 0.5 or greater, the model predicts 1 (survived), otherwise 0 (died).

Get the predictions for every single row in your testing set. Then compare these results with the testing dependent variables and calculate the accuracy, precision, and specificity. Accuracy will tell you generally the percentage of how many predictions were correct relative to the total test set, precision will tell you the percentage of survived predictions it got correct, and specificity will tell you the percentage of death predictions it got correct.

With this, you could go a step further and look into a confusion matrix, possibly write a function to output that as well, or calculate recall and F1-score.

Overall:

There are a lot of things you can do with this. It is daunting because it sounds very complicated, but I promise it’s not that bad. This is good too for applications, if you do get into machine learning or data science later, it’s practice for going through the steps of preprocessing the data for the model, seeing the behind the scenes of the model, and understanding how to evaluate it. You could work on this further or in later projects to generally handle any data set, maybe make a cli program that works with this where the user identifies dependent from independent and your system does the rest.

This will be challenging, but I think you can do it if you set your mind to it.

Good luck if you go with this option. If not right now, that’s fine too, pocket it for later and give it a shot!

4

u/[deleted] 25d ago

[removed] — view removed comment

1

u/slightlypug 25d ago

can i ask would you recommend using claude to guide me through a tutorial or simply just think through it and use a reference? i feel dumb like its obvious but i genuinely don’t know how to start sometimes

2

u/Dry-Trick-2234 25d ago

Claude works fine as a rubber duck when you hit a wall but don't let it write the skeleton for you. Open a blank main.cpp and make the smallest thing compile first: a menu loop that prints options and reads an int. That single file teaches you the build step, the run step, and how fast the edit cycle actually is. Once it runs, add one function that does something real like writing a line to a text file. You will hit linker errors, include order issues, and const correctness complaints that no tutorial explains because they assume the starter project already works. What is the first menu option you would actually want to use?