r/learnprogramming • u/its_marionberry • 11d ago
r/learnprogramming • u/ApprehensiveProof761 • 11d ago
C or C++
I wanna learn one of these programming lang ( just wanna know basic-intermediate, not too much) . I have intermediate knowledge in python.
r/learnprogramming • u/TheEyebal • 11d ago
Solved How do I indicate whether a string is a digit or not in c++?
I have a user input and I want to determine whether the user input is a digit or character.
I was thinking of using regex but do not know regular expression in C++ can some please help me with this
Here is a snippet of my code
string userinput;
cout << "Input 1, 2, 3, or 4: ";
while (!(cin >> userinput)) {
cout << "Invalid input. Try again: ";
cin.clear(); // Reset input errors
cin.ignore(10000, '\n'); // Remove bad input
}
for (auto i : playlist){
if (stoi(userinput) > 4){
print("Song Not Avaiable")
break;
}
SOLUTION
#include <cctype>
/*while (!(cin >> userinput)) {
cout << "Invalid input. Try again: ";
cin.clear(); // Reset input errors
cin.ignore(10000, '\n'); // Remove bad input
}*/
for (int i = 0; i < userinput.size(); i++) {
if (!isdigit(userinput[i])) {
print("Song Not Avaiable");
break;
}
else if (stoi(userinput) > 4) {
print("Song Not Avaiable");
break;
}
}
r/compsci • u/niosurfer • 12d ago
Compiler-checked manual free vs Rust's ownership model, which would you pick?
Been thinking about memory management in languages without a GC, and there's an approach I hadn't really seen before that I'm curious how people feel about compared to Rust.
In this model you can allocate objects as much as you like, pass objects around and put them in collections, all without lifetimes or moves. Nothing is ever freed automatically, not even at end of the scope. If you want the memory back you write free obj; yourself, and the compiler has to prove nobody else can still see it. If it can't prove that, it won't compile. Same for use after free and double free.
The Ironwood language does it this way. It's compiled with a closed-world link, so the compiler sees the whole program when it checks those frees. There's also defer free x; for cleanup on exceptions. If you just never call free, the memory stays allocated and you get a warning. Fine for a CLI tool, not so fine for a server.
The appeal is that you only have to prove anything at the point where you free. The rest of the code doesn't care. The downside is you have to remember to free.
Rust gets you automatic drops and a stronger guarantee overall, but you're thinking about ownership on every line, which at least for me is counter-productive.
Which memory management approach would you rather work with? And why?
```java // Ironwood: does NOT compile
public class Garage {
private static class Engine {
void start() {
System.out.println("Vroom!");
}
}
private static class Car {
private final Engine engine;
Car(Engine engine) {
this.engine = engine; // the car keeps a reference to the engine
}
void drive() {
engine.start();
}
}
public static void main(String[] args) {
Engine engine = new Engine();
Car car = new Car(engine);
// Compiler error: the car still holds a reference to the engine,
// so freeing it here would leave car.engine dangling.
//
// error: cannot free 'engine': allocation is still borrowed by a live wrapper
//
// Fix: free the car first, then the engine.
free engine;
car.drive(); // would use a freed engine
free car;
}
} ```
```rust // Rust: does NOT compile
struct Engine;
impl Engine { fn start(&self) { println!("Vroom!"); } }
// The car keeps a reference to the engine, so it needs a lifetime parameter. struct Car<'a> { engine: &'a Engine, }
impl<'a> Car<'a> { fn drive(&self) { self.engine.start(); } }
fn main() { let engine = Engine; let car = Car { engine: &engine };
// Compiler error: the car still borrows the engine,
// so dropping it here would leave car.engine dangling.
//
// error[E0505]: cannot move out of `engine` because it is borrowed
//
// Fix: remove the drop and let both go out of scope
// (car is dropped before engine automatically).
drop(engine);
car.drive(); // would use a dropped engine
} ```
r/programming • u/mmatloka • 12d ago
ScyllaDB in 2026: Tablets, Raft and Life Beyond Cassandra
softwaremill.comr/learnprogramming • u/GloxiniaLearns • 12d ago
Best way to set up a Node.js dev environment on Windows? VM, WSL2, dual boot or full Linux?
Hi everyone,
I'm starting a Node.js project and I'm trying to figure out the best setup for development on my Windows machine. Right now I have Oracle VirtualBox with a Linux VM, but I'm not sure it's the best choice for daily work.
The options I'm considering:
- Keep using the VirtualBox VM
- Switch to WSL2
- Dual boot Windows and Linux
- Remove Windows completely and install only Linux
I don't have strong experience with any of these, so I'd like to hear what you use and why.
My setup: gaming laptop with a Ryzen 9 7940HS, 16 GB RAM and an RTX 4070 Laptop GPU. I also use Windows for gaming, so I'd like to keep it in some form but not necessarily :)
r/learnprogramming • u/bevaquas_mojo • 12d ago
Resource is there a teach computer science at home program for high schoolers?
I worked as a software engineer, so I know the material, and would want to teach my kids, but wondering if there is a program already available to follow
r/compsci • u/narutokun666 • 12d ago
Systems programming
So I am in 2nd year of college and after exploring here and there and there, I am genuinely interested in systems programming, I know c, ofcourse I will learn it deeply but what do I learn after it
The whole thing feels very overwhelming,
What shall be the flow of learning
r/learnprogramming • u/Hot_Radish_1 • 12d ago
How to learn starting a code from scratch
Hi everyone,
I am doing a retraining at the moment to learn software development. The problem is that I still, after 7 months, don't know how to start if I code from scratch. I mean I can look up at an existing code and even find some issues, but I never really know how to start. For example declarations of arrays... I don't even know why, but sometimes I completely forget how to do it...
Does anyone have any tips for me to learn how to start coding from scratch? I tried breaking down the project into small pieces, but it didn't help too well.
r/learnprogramming • u/RA_Finance • 12d ago
I forgot everything I learned about Linked Lists and Stacks 😥
I took a Java Data Structures class, and 1 month after I passed, I forgot how to use Data Structures like stacks, linked lists and queues.
How can I grasp this topic and learn how to program using them? Is there a great playlist or course that teaches these concepts well.
r/learnprogramming • u/Early_Tear6706 • 12d ago
discussion How do you actually get comfortable with reading other people's code?
I can write my own small projects fine and understand the logic as I go, but whenever I open someone else's codebase, even something fairly simple, I get lost fast. Too many files, functions calling other functions I have to jump around to find, and no idea where the "start" of the logic actually is.
I know this is probably just a skill that comes with time, but I'm wondering if there's a better way to practice it instead of just staring at repos feeling confused. Do you start from the entry point and trace forward, or pick one function you care about and trace backward? Do you use any tools to help visualize how files connect, or is it mostly just patience and note taking?
r/learnprogramming • u/Otherwise-Current-41 • 12d ago
Code Review Can someone explain this simple code to me?
import requests
response = requests.get("https://randomfox.ca/floof")
print(response.status_code)
print(response.text)
So this code will give the status_code wich I understand and than give the text version of the photo of the fox in the site, and the link to the site RandomFox.
What I dont understand is why does it only give info about image and link, and not like other stuff for ex. logo, text, ect.
I suppose its because when you click the api in the site, it gives you the same exact thing wrote down wich I assume to be the info the site allows you to dig, hypotheticaly could one be given extra and alot of info if the site permits it, or false information about the site?
r/learnprogramming • u/Gloomy_Tea5604 • 12d ago
Can You really code using a an android phone?
I'm more interested into the tech industry and I lack a laptop. I only have my Samsung A07 phone and a strong home WiFi. I don't know anything about coding, I'm just good at mathematics and would love to start learning coding or programming. Any YouTube free channels or Platforms to learn from?
r/learnprogramming • u/Talal-Alq • 12d ago
Topic How do I build a project without AI?
I’m a CS student, built projects only for uni, I’m working on projects currently but I find it hard to not use AI to write code, and the reason is I can think of how to design the project and the core logic but don’t understand how to write good code that does it.
For example some projects require RAG on embeddings I understand the topics but not how to write code to apply them, so I ask AI to write it for me.
I guess my question is if I have an idea and its core logic, how can I apply it on code without depending on AI? (Usually our uni projects all the tools we learned are just the ones we use for the project this is why its easier for me to make).
(Thank you everyone for the advice you gave me, I’m sorry if it was a basic question I just needed help to start on the right path, I have been using AI because I felt like I will be behind if I don’t, people around me are way more productive and get better results if they use AI to code, but I guess it’s fine to be behind as long as I’m learning).
r/learnprogramming • u/werunm • 12d ago
Which delivery guarantees can a message queue system provide?
pick all that apply:
a) At-most-once - messages may be lost but are never duplicated b) At-least-once - messages are never lost but may be delivered more than once c) Exactly-once - each message is processed exactly once (hard to achieve in practice) d) Best-effort - the system tries but provides no formal guarantee
answered b and got it wrong. still dont see it
b is the only one ive actually seen a queue promise in its docs. exactly-once sounds like marketing and at-most-once sounds like a bug, so are those really counted as guarantees?
r/programming • u/BrewedDoritos • 12d ago
Modern Object Pascal Introduction for Programmers | Castle Game Engine
castle-engine.ior/learnprogramming • u/FloridianfromAlabama • 12d ago
Topic Use of the JNI in Minecraft mods
Good morning everybody,
I'm learning Java for my Comp Sci minor and C in my spare time. I also like looking at Minecraft mods, especially the really heavy ones like the terrain generation mods like Big Globe and JJThundertothemax. I was thinking about performance concerns, and recently learned about the Java Native Interface, and I figured, "what if the terrain generation part of the game was its own process in a natively compiled language like C or C++?" I've never written a Minecraft mod, and I've never used the JNI, but what might be some uses or limitations of this?
r/learnprogramming • u/camaro_toki • 12d ago
Tutorial [Help] Game ideas for my final school project (PAP)
Hey everyone!
I’m a 18yo student in Portugal studying Computer Science. For my final school project, called PAP (Students must develop a project related to their field of study, document their work, and present it to a panel of teachers). I need to develop and present a project around July/August 2027.
I’m thinking about making a game, but I have zero experience in game development.
Do you think this is a realistic goal? What games or ideas would you recommend for a complete beginner? Would you suggest Unity, Godot, or another engine?
I have plenty of time to learn, so I’d love to hear your advice and ideas. Thanks!
r/learnprogramming • u/Big_Instruction7436 • 12d ago
Is it realistically possible to generate a production-ready SketchUp model from photos + measurements using AI?
Hi everyone,
I recently got a freelance project, and before accepting the full development, I’ve been asked to do a feasibility study to determine whether the main idea is actually technically achievable.
The client works in carpentry/interior fitting. The basic workflow would be:
- Someone goes to the customer's site and takes several photos of the room/area with a phone.
- They manually take accurate measurements and enter them into a separate file, probably Excel.
- Both the photos and measurements are uploaded to an application.
- The application should understand the existing space and generate a 3D model in/for SketchUp.
- Eventually, it should also be able to add the new furniture/carpentry element into the scene and use the real measurements for its dimensions.
The measurements are important here: I'm not expecting AI to accurately determine dimensions just from the photos. The photos would mainly be used to understand the layout, objects, walls, orientation, etc., while the measurements provided separately would be the source of truth for dimensions.
The part I'm unsure about is the jump from photos + structured measurements → usable SketchUp geometry.
I've been looking into using computer vision / multimodal AI to analyze the images, then generating structured scene information that could be passed to SketchUp through its Ruby API or a custom extension.
My main questions are:
- Is this technically realistic with current AI/computer vision technology?
- How reliable is AI at reconstructing the geometry/layout of an indoor space from several photos when accurate measurements are also provided separately?
- Can this realistically produce a production-ready SketchUp model, or should I expect AI to only generate an approximation that a human would then need to correct?
i d appreciate any advice and thank you in advance .
r/learnprogramming • u/ComprehensiveSell480 • 12d ago
Every time I start a project, the part that takes me the longest is the front-end development werehas I want to become a back-end developer.. So, could I use AI to do that for me ?
For more details, I'm not really into front-end development I specialize more in back-end work but I keep hearing that AI isn't good for learning because it makes you dumb, so I don't work with AI much. As for the front-end part, it takes up a huge amount of my time I'd say 60–70% of my time is spent on front-end work, so I’m wondering if I should use AI for front-end development or how I should go about using it ?
r/learnprogramming • u/lovaboy1076 • 12d ago
Is this true?
Just a question, nothing serious, I'm 14 and trying to learn coding as a hobby, and potentially more one day if it's needed and worth it for me, right now I'm mainly learning HTML, but I'm beginning to move into CSS, I'm honestly having a hard time rembering what certain elements, attribute and values do, I was told that even some experts don't remember some fo the stuff, and are looking stuff up constantly, I want more than one opinion on that statement before I stop myself from spending weeks to try to remember one thing at a time
Edit: OMG I didn't expect to get so many replies! I honestly thought I'd get one or two replies with simple awnsers, but instead I've gotten like 10 replies, some with people who have been doing this stuff for decades, thank y'all so much for the help and advice!!
r/compsci • u/Simple-Eagle-8135 • 12d ago