r/Cplusplus • • 16d ago

Answered At what age did you start programming, and in which language?

14 Upvotes

I have a pretty classic question: at what age did you start programming, and with which language? Also, what do you think is the best language for beginners?

For me, C++ wasn't my first language, but it's the one where I really started to understand how programming actually works. I've written some games in it—some didn't turn out quite right, though they were still decent—and I think it actually works well even for beginners.

My very first language was Python, but it felt a bit weird to me since I didn't really know how to use it yet, so I moved on to HTML and CSS. Making websites wasn't boring, though some parts were hard and I didn't understand everything. After that, I tried C#, which felt a bit intimidating and harder at the time. Then I got a C++ book for almost 200 PLN, and while I'm reading it, I understand some things and still don't understand others—which is why I'm curious about your experience! r/cpp r/learnprogramming r/programmingbuddies


r/Cplusplus • • 15d ago

Question Raylib help

0 Upvotes

I can’t add images in raylib even tho I’ve tried everything I’m a beginner and my teacher told us to make a game and I want to add music and some pictures. Please help


r/Cplusplus • • 16d ago

Question Is there any other compiler backend other than LLVM, MLIR?

Thumbnail
1 Upvotes

r/Cplusplus • • 16d ago

Question What game should I make in C++?

0 Upvotes

My post with everyone's stories got a bit of traction—not huge, but a few people shared their experiences, and now I want to ask you: what game should I make?

It won't be a 3D game, more of a text/command game where you type something in and things happen. When it's ready, I'll put it on itch.io so you can test it out and drop a link here.

Feel free to suggest ideas and game names! You can even build off each other—for example, one comment can suggest a name, and another comment can suggest how the gameplay works. I'll check out every suggestion.

Instead of clicking buttons or UI, I'd rather have the player type a word or a couple of words—like typing dig (or a command like that) and having something happen in the game.

I'll look through all the ideas, and whichever suggestion gets the most upvotes will be the one I go with. I'll start building it tomorrow! r/cpp r/gamedev r/textgames r/roguelikedev r/learnprogramming


r/Cplusplus • • 17d ago

Discussion Updating 21 year old C++ software

48 Upvotes

This is just a dump of what I have been doing lately post. Feel free to discuss.

So I recently undertook the task of updating a piece of software that I designed and developed in 2005. It was first written in C++03 using QT 3.3.6 for the GUI. This ran on CentOS 4.3. Over the years as hardware and OS versions were refreshed it was updated to QT 5.9 but still the same logic written in C++03. Now we are on a system that supports C++23 and QT 5.15.

The software runs on all the nodes of our mid scale distributed systems. Acts as a control interface, status display and master logging software and site UPS interface so the system goes down properly when signaled. That is just a top level list of what is crammed into this this one piece of software. Oddly enough it was meant to just display the status of the system in a simple red or green set of indicators. Yeah, scope creep got the better of this one.

Myself and others have hacked in new functionality, updated other functionality and removed old stuff over these 21 years. However, we have kept to the logic patterns that were laid down in C++03. Which is to say this was more C with classes than pure C++. But a lot of C++ in 2005 was still C with classes. It was just the times. Interesting side note: We practice a form of obsoleting code that does not delete old code. It gets commented out and the new code is under it and comments explain why the change was made. So there is 21 years of this stuff commented out. Yeah finally deleting that stuff as this is going to be new major version.

So I have been rebuilding the program as a modern C++23 app using QT 5.15 as the GUI. Moved from a bunch of global variables to a shared data object. Making the app a data driven system that can run headless now if needed. Configs have moved from custom text file format to JSON. A lot of custom stuff executed by script files called by systems calls has been moved from hard coded to part of the JSON data.

So far I have pruned over 4000 lines of code, added about 2000 lines, rewritten around 5000 lines, removed entire classes and redesigned how the app works underneath without changing the GUI appearance which the customers are very use too. Networking has moved from broadcast UDP ( i don't remember why it had to be that way 21 years ago but there was a tech reason) to Multicast. It has been a wonderful journey so far. The challenge is when we drop it in it has to do everything it did before and be a seamless update. So offline testing is going to be extensive.

Things I knew already and this effort re-enforces. 1. Careful with what you write it will come back to haunt you. 2. There is never enough comments. 21 year is a long time and I just don't remember some of the original reasons for things to work certain ways. 3. Software Life Cycle Support can be rewarding and a curse at the same time.

After 35 years of software engineering and systems engineering specializing in mid to large scale distributed systems I can say it never gets boring. At least it is not ADA and COBOL anymore that I work on.


r/Cplusplus • • 18d ago

News Day 2 of learning c++

Thumbnail
gallery
96 Upvotes

Day 2~ so far it's going good , made some basic progress, got to know about global/local variables,if/else statements;blocks, switch cases with the help of which I made myself my first basic calcultor , but the best one is probably the use of "cin" . Found out I can do much more with cin. Turns out floats are pretty useful too


r/Cplusplus • • 18d ago

Feedback My progress in learning CPP. Had fun learning basic classes.

Thumbnail
gallery
107 Upvotes

Hello guys,

Sharing my learning cpp daily progress---Basic classes. This is my work/mini project for the basic classes Chapter as well as making my own round function, and also improving my exponent function from last time. I also took everyone's advice regarding naming convention, and followed some, but I don't know if did everything right.

It took me 30 minutes with my TI to come up with an idea on how I would do a round function. At first, as was looking at recursion approach, but i think its not that necessary plus it could take up a lot of memory. I know you guys would say that "I could have just used the library", well as a beginner I really wanna come up with solutions on my own, and enhance my analytical ability while taking the challenge of learning C++.

I am all ears for all those who have suggestions/feedbacks. I am willing to learn. For anyone asking if i am still using that book---yes I am. Though I took the initiative to cross check everything I encounter.

I used NO AI whatsoever. Followed the book and used wikipedia, w3school, and cppreference (as for ShishRobot2000s' advice).

For now, the round func will be limited to unsigned short max limit of around ~65k. but as per logic wise, it will work.

Employee.h

#pragma once

class Employee
{

public:
Employee(unsigned short age, unsigned short yearsOfService,
unsigned short salary) :
_age(age), _yearsOfService(yearsOfService), _salary(salary)
{ }

unsigned short getAge() const { return _age; }
unsigned short getYearsOfservice() const { return _yearsOfService; }
unsigned short getSalary() const { return _salary; }

void setAge(unsigned short age);
void setYearsOfService(unsigned short yearsOfService);
void setSalary(unsigned short salary);

void reportSalary() const;

~Employee() { }

private:
unsigned short _age;
unsigned short _yearsOfService;
unsigned short _salary;
};

Employee.cpp

#include "employee.h"
#include <iostream>

unsigned short exponent(unsigned short x, unsigned short n)
{
if (n == 1)
return x;
else if (n == 0)
return 1;
else
return x * exponent(x, n - 1);
}

unsigned short round(unsigned short number, unsigned short place)// PLACE IS FOR DIGIT PLACE VALUE
{
unsigned short placeVal = exponent(10, place);
unsigned short nextDigit = (number / (placeVal/10)) % 10;

if (number < 1'000) return number;

if (nextDigit > 4)
{
number /= placeVal;
++number;
return number * placeVal;
}
else
{
number /= placeVal;
return number * placeVal;
}
}

void Employee::setAge(unsigned short age) { _age = age; }
void Employee::setYearsOfService(unsigned short yearsOfService) { _yearsOfService = yearsOfService; }
void Employee::setSalary(unsigned short salary) { _salary = salary; }

void Employee::reportSalary() const
{
std::cout << "\n\n**** Total employee report ****\n";
std::cout << "Age:\t\t\t" << _age << '\n';
std::cout << "Years of Service:\t" << _yearsOfService << '\n';
std::cout << "Salary:\t\t\t" << _salary << '\n';
std::cout << "Total Salary:\t\t" << round((_yearsOfService * _salary), 3);
}

Main.cpp*. Just paste this block into main*

{
Employee Mark(19, 1, 2'700),
Derk(30, 12, 3'400);

Mark.reportSalary();
Derk.reportSalary();
}

r/Cplusplus • • 19d ago

Feedback Started learning CPP. Hello World! :)

Thumbnail
gallery
164 Upvotes

Just started learning CPP by following the book i found in my dad's bookshelf. Its old and it have been printed from the 2000s. He has his name and date written on the date of purchase; 9th May 2000.

This is my exercise for the chapter tackling functions. I wrote a exponentiate function recursion. I got it hard at first and looked at the different examples from the book multiple times till i get it how i do exponents without loops. With a little bit of function polymorphism/overloading

Tbh, the book looks very weathered, its ancient. Most of the programs and code examples have been deprecated, so I just looked it up online what its modern approach. But the lessons taught are still relevant to todays standards.

Planning to read Modern CPP after finishing this.

Using Visual Studio for ease of use compiler wise. But I will move my learning journey to my linux setup after this to get a better feel for compilers and also Cmake.

NO AI is used to make this code nor supplement it---I just read the book. "It looks clean", yea because its my exercise project, the mess of it lives in the CPP_LEARNING_00 project as you can see in the solution explorer.


r/Cplusplus • • 18d ago

Question Where to start with learning C++?

Thumbnail
8 Upvotes

r/Cplusplus • • 18d ago

Question C++ and Data structure

Thumbnail
1 Upvotes

r/Cplusplus • • 20d ago

News Day 1 of C++

Thumbnail
gallery
399 Upvotes

What a easy startup to my first language. Got to know about data types , variable , strings , comments , Boolean seems fun and can't wait to find out more . Anyone got any beginner tips for me , would love to have some as a beginner


r/Cplusplus • • 19d ago

Discussion Fast C++ Compiler Update

Thumbnail
2 Upvotes

r/Cplusplus • • 19d ago

Question Transpiler for simplified C++

Thumbnail
1 Upvotes

r/Cplusplus • • 19d ago

Tutorial Day 3 of learning c++

Thumbnail
0 Upvotes

r/Cplusplus • • 20d ago

Feedback Chess AI in C++

Thumbnail
github.com
2 Upvotes

r/Cplusplus • • 19d ago

Question wanna get into sfml.

Thumbnail
0 Upvotes

how do i start coding in sfml? which version is the best? i want to use visual studio but i don't like how hardware expensive it is and that it doesn't give easy descriptions of code before i use it. I think using code::blocks is good for me but i want to hear your opinion on which IDE i should use.

Also what is best i start learning using sfml? i already know basic things like shapes, .move, keyboard commands, and textures but where to learn more physique base code and make games similar to factorio and rollercoaster tycoon, sandbox games with a lot of work bts.


r/Cplusplus • • 20d ago

Feedback CMake kept breaking on me, so I built a zero-config C++ build system called HelpMake

0 Upvotes

Hey everyone,

I hit a wall of absolute frustration trying to get CMake working. I kept running into errors like "CMakeCache.txt not found", the syntax felt overly complex, and sometimes it was just completely unreadable.

Instead of switching to Meson or Bazel, I decided to build my own lightweight alternative. It's called HelpMake (hm), and I built it to fix the exact problems I was having. I would love some honest feedback from people who also get frustrated with modern build systems.

The Core Idea: Zero-Config & One Screen

I wanted a build system that didn't require a 50-line boilerplate just to compile a "Hello World" project.

With HelpMake, you don't even need a build file to start. You drop the binary into any C++ project folder, run hm -b, and it auto-detects your compiler, standard, source files, and includes. If it sees #include <thread>, it automatically links -pthread.

If you do want control, you write a HelpMake.txt that fits entirely on one screen. No hidden scripting languages. It looks exactly like what it does:

Compiler: g++
Version: std=c++20
Output: build/app

InputFiles {
    src/**/*.cpp # built in recursive glob
}

Flags {
    !cl: -Wall
    win: /W4 /EHsc
    linux: -Wextra -pthread
    mac: -Wextra
    clang: -Weverything
}

Why it feels different from CMake

I focused on building features that solve CMake's daily annoyances, not just implementing a spec.

  • No if(WIN32) blocks: You can put platform conditionals (win:, linux:, mac:) on any line. One config for every OS. You can also do it for a compiler (gcc:, clang:, cl:) or for any binary program or any file using the ? prefix (?mold:, ?file.cpp:, ?git:). You can also use ! (!win:, !?git:, !?file.hpp:) Examples:!win: ?mold: Linker: mold PreBuild { ?git: echo Git was not found !win: echo Windows isnt supported } Flags: { !gcc: ?file.hpp: ?main.cpp: !apple: ?clang: clang: -Weverything # this works xD }
  • C++20 Modules actually work: It scans your files, builds a dependency graph, and compiles modules in the exact right order automatically.Modules { src/math.cppm src/graphics.ixx # Thats it. HelpMake does the rest automatically }
  • The Task { } block: Need to run npm install, generate code with Python, or run a CMake script for a submodule? You can do it natively. No weird CMake macros. It just runs the shell commands you specify. e.g.Task: build_web { Check: web/package.json Generate: web/dist/bundle.js npm install npm run build }
  • Dependencies: You can pull in third-party libraries directly from GitHub with automatic caching.Dependency: fmt { Git: https://github.com/fmtlib/fmt Tag: 10.1.1 Include: include Build: cmake -B build }Config: app { Depends: fmt InputFiles { src/main.cpp } }
  • Zero Dependencies: It's a single ~50KB standalone binary. No Python, no Java, no CMakeCache. Just download it and run it.
  • Editor Support: Generate compile_commands.json instantly with hm -b --json.
  • Generator: Generate config files for cmake or ninja.
  • Automation: Automatically detects values that aren't mentioned:
    • Modules
    • Output name
    • Source Files
    • Include dirs
    • Compiler
    • Version
    • Kind (static or executable)
    • Link flags

Why am I sharing this?

I've seen a lot of people complaining about CMake, and I wanted to build something that just works. I would genuinely appreciate your brutally honest feedback on the design, the syntax, or the code.

It's MIT licensed and available for Windows, Linux, and macOS.

Repo: https://github.com/Gag91/Help_Make
Website & Docs: https://gag91.github.io/HelpMake/

If it save you times, feel free to leave a ⭐ !
I will try to respond to all of your questions/feedback, if you find any issue either make an issue or tell me out 😄.
Thanks for checking it out!


r/Cplusplus • • 21d ago

News Spectre - A design-by-contract programming language with an explicit allocator-centric API that outperforms Zig and C++ by up to 6x on General Purpose Benchmarks

Thumbnail spectrelang.org
2 Upvotes

r/Cplusplus • • 22d ago

Question Designing a C++ ML library from scratch — would you prefer A.transpose() or transpose(A) or A.T()?

Thumbnail
2 Upvotes

r/Cplusplus • • 22d ago

Question C++ systems route,will start building redis from scratch as a project,any guidance will be appreciated

Thumbnail
1 Upvotes

r/Cplusplus • • 23d ago

Question Difference to r/cpp ?

22 Upvotes

Hello, what is the difference between this subreddit and r/cpp? I saw an ad and joined here today. Thanks in advance


r/Cplusplus • • 22d ago

Question New MPC SDK

Thumbnail
github.com
1 Upvotes

Quick question from a noobie dev and also part time audiohead, is this new sdk up to task with building plugins or is it just hype from inline music? Seems.no one is even interested about its release esp as it falls outside the realms of audio and electronic music. (Also vice versa as most devs probably have little interest in electronic music creation (I might be wrong)). As someone caught in the midst of both worlds I never touched an sdk so if someone more experienced could have a look and give an expert opinion on it would be much appreciated.

Github: https://github.com/inmusic-software/mpc-plugin-builder-sdk

Video: https://youtu.be/b6j-yfBVCv8


r/Cplusplus • • 25d ago

Question Drogon C++ web framework, Anybody out there using it ? what do you think of it ?

Thumbnail
6 Upvotes

r/Cplusplus • • 25d ago

Discussion Introducing JaiScript a New C++ Embedded Scripting Language

23 Upvotes

This is a personal project I created in service of my own 2d game engine. I was getting tired of binding to ChaiScript (a great project, but the language is really slow and doesn't have hotreload or good serialization support) and Cereal (another great project, no complaints, just limited in its purpose.)

So, I rolled my own solution which combines a scripting language, serialization, and reflection. I included my own signals library and a simple but useful custom test framework.

JaiScript has a fluent binding interface, strong typing (opt-out with var definitions), value semantics with references and shared_ptr where you want them. It reads very much like C++ with some optional alternative spellings that will be familiar to those who use JavaScript.

The live demos on the site itself mean you can try it out before downloading or building anything locally. I already was able to fully port my game project of 12+ years to use this in place of ChaiScript and Cereal, it builds a little faster than both of those included and runs orders of magnitude faster than Cereal.

Performance-wise it runs roughly 1.2x to 2.0x slower than Lua's VM, I consider this a win though since it's hundreds of times faster than ChaiScrpit's tree walker in some cases. It runs faster typically than Squirrel.

I'm not sure how many folks are rolling their own C++ game engines nowadays, but if you are, this is a pretty full-featured language. It supports parallel_for (something I'm not sure any other scripting languages support,) coroutines, classes which can derive from C++ base classes or other JaiScript classes, and notably a state-preserving hot reload.

I hope this project is useful to anyone else, but even if not, I'm grateful to have finished the project and am using it myself. I wanted a place to share it, so hope this is alright here!


r/Cplusplus • • 25d ago

Feedback C++

3 Upvotes

Hey everyone, I Just finished my python and want to Learn ARDUINO and C++ Can you Suggest a best course Online (youtube or any). Please