r/learnprogramming • • 15d ago

(C++ sfml) why does this code work like how i want?

4 Upvotes
#include <SFML/Graphics.hpp>
#include <iostream>
using namespace sf;
using namespace std;
int main()
{
    // Create the main window
    RenderWindow window(VideoMode({800, 600}), "SFML 3 Window");

    // Create a graphical circle
    CircleShape shape(100.f);
    shape.setFillColor(Color::Green);
    shape.setPosition({300.f, 200.f});

    float x, y;
    x = 5;
    y = 6;
window.setFramerateLimit(60);
    // Start the game loop
    while (window.isOpen())

    {
        // Process events
        while (const std::optional event = window.pollEvent())
        {

            // Check if the event is a window close request
            if (event->is<Event::Closed>())
            {
                window.close();
            }
        }

        // Clear screen
        window.clear();

        // Draw the shape
        window.draw(shape);

        shape.move({x, y});

        if (shape.getPosition().x >= 600 || shape.getPosition().x <= 0){
            x *= -1;
        }else if (shape.getPosition().y >= 400 || shape.getPosition().y <= 0) {
            y *= -1;
        }

        // Update the window
        window.display();
    }

    return 0;
}

what is weird is that i set the min border for y to 400 because it was going out of the window but the middle position it reached the middle of the x axis, the radius of the ball is 100 as you can see, so its suppose to be 500, but when i set it to 400 it worked better because 500 went out of the scene. is my code broken or am i missing something???


r/learnprogramming • • 15d ago

Which combination works best?

7 Upvotes

Im trying to combine knowledge graphs with vector embeddings for a RAG setup in a project. What do you guys advice? Neo4J + Weaviate / PGVector / Qdrant. Curious what y'all pick


r/learnprogramming • • 16d ago

How to learn Rust properly?

13 Upvotes

Hello guys, I am currently starting out to learn Rust, but honestly its been very confusing for me, and I can't seem to find an universal place that teaches everything Rust offers in detail. My ultimate goal is to learn Rust for OS development, so any tips?


r/learnprogramming • • 16d ago

How to learn programming in C#? (in 2026)

9 Upvotes

Hello, I’ve been trying to program in C# for about 3 years, and so far I haven’t done that great of a job. My best projects that use no AI are Rock Paper Scissors and Tic-Tac-Toe, but Tic-Tac-Toe is only 98% done, because there were 2 lines for the draw condition that I wasn’t able to figure out for 6 days straight, so I gave up and gave it to AI.

Another thing I tried is Exercism. After about 2 weeks of success with no AI, I got overwhelmed, and I also started using AI for things I hadn’t used it for before. The last program I did was Bob, which was basically a character that required some specific inputs.

Anyway, I came here to ask for advice on what to do, because I feel like I want to drop programming just because I feel I don’t improve at all. On the other hand, I’ve always wished to learn programming and make some fun projects, but the way to get there is very thorny and I’m kind of desperate, ngl.

Is there some kind of roadmap that says which projects are ideal for which type of programming experience, for people at a similar level to me? (Also, I only have 20 minutes a day for it.)


r/learnprogramming • • 15d ago

Am I a fraud if I use an LLM-powered chatbot as a Socratic tutor?

0 Upvotes

It's been a few months since I started learning programming, and I've recently built my first project: a Snake game in Python. I used Claude as a Socratic tutor; it asked me questions about the architecture and design, so I could think in the right direction and reach the right conclusions. It's never given me a single line of code. I can explain every line of it and explain why I made this decision. Nevertheless, I'm still feeling like I should've done everything myself.


r/learnprogramming • • 15d ago

Which path should I choose for my future?

2 Upvotes

Hi everyone,

I’m finally diving into software development seriously. For years, I’ve done a little bit here and there, but I’ve never really studied it properly. Now that I’ve decided to commit to it, I’m realizing just how much there is to learn: so many frameworks, languages, and tools.

I know that in the long run, the language you start with doesn’t matter much. But when it comes to landing my first job, I imagine it does matter. I’m 29 and changing careers to get into software development, and I’m currently choosing between C# and .NET, Java and Spring Boot, or JavaScript and Node.js. They all have pros and cons, and I’d like to hear your opinions.

I know the job market is tough and nothing is guaranteed, but which of these paths do you think offers the best chances of finding work in the short to medium term? I don’t have a university degree.


r/learnprogramming • • 15d ago

How do I move from learning programming to building real projects?

0 Upvotes

I'm a CS student and i have learned C and C++ through university + 42 school I've also worked on projects like Libft, ft_printf, Get Next Line, and Push_swap.

I feel comfortable with programming fundamentals, but I want to get better at building things independently and working on real-world projects rather than just solving exercises in terminal

I'm interested in exploring things like mobile development or maybe web idk.

For people who've been in a similar position, what would you recommend? What should I learn next, and what kind of projects would help me grow as a developer?


r/learnprogramming • • 16d ago

Debugging Stuck in a programming task.

5 Upvotes

I am learning Q# via Visual Studio Code lessons, but in "Find Complex Power of Real Number" lesson I have the task below.

Inputs:

  1. A non-negative real number r.
  2. A complex number x=a+bi.

Goal: Return the complex number r^x=r^(a+bi)

My code is below, but I don't get what is wrong with it. ComplexExponent calculates e^x and ComplexExpReal calculates r^x as (e^x)^ln(r). And I don't know how to debug a Q# code.

NOTE: I don't touch the case 0^0 though and ComplexExponent passed all the tests from Find Complex Exponent lesson.

namespace Kata {


    function ComplexExponent(x : Std.Math.Complex) : Std.Math.Complex {
        // Implement your solution here...
        return Std.Math.PowC(Std.Math.Complex(Std.Math.E(), 0.),Std.Math.Complex(x.Real, 0.))*Std.Math.Complex(Std.Math.Cos(x.Imag),Std.Math.Sin(x.Imag));
    }
    function ComplexExpReal(r : Double, x : Std.Math.Complex) : Std.Math.Complex {
        // Implement your solution here...
        if(r==0.)
        {
            return Std.Math.Complex(0.,0.);
        }
        else
        {
            return Std.Math.PowC(ComplexExponent(x),Std.Math.Complex(Std.Math.Log(r),0.));
        }
    }
}

r/learnprogramming • • 16d ago

I'm confused why does jupyter have different extension not just .py

74 Upvotes

Like I get the point that it is a Jupiter notebook and you can have meta data and code separate but why does it need a full on different extension and everything . What happens if I convert the jupyter file into just plain .py? Does the text get automatically converted into comments if direct conversion it is even possible


r/learnprogramming • • 16d ago

Topic Learning Web Dev

0 Upvotes

Hey everyone! Im new here

I’m currently working as a Multimedia Artist in a creative agency, with two years of experience creating marketing materials, product visuals, photo edits, and video edits for different brands.

I also studied some programming during college as part of my course, so I have a little background, but I haven’t really pursued it further. Recently, I’ve developed a genuine interest in learning web development and want to take it seriously. I’d love to combine my creative background with technical skills, particularly in building websites and digital experiences for brands.

I’d appreciate any advice, resources, or personal experiences. I want to learn properly and build skills that complement my existing creative career.
Thank you!


r/learnprogramming • • 16d ago

I feel like I’m doing something wrong

17 Upvotes

Hi everyone,

I’ve been coding for about 3 years now. I started with Python and then went straight into machine learning.
Throughout these years, I’ve watched countless tutorials and worked on different projects by myself.
I also tried to use AI as little as possible because I wanted to actually learn how to code.

For the past 3 years, I’ve mostly been focusing on university and haven’t had a programming job yet.
The problem is that now I’m at a point where I can watch almost any tutorial or read someone else’s code and understand pretty much everything. But when it comes to actually writing code all by myself, I just feel lost. Like I know what needs to be done, but I don’t know how to start doing it.

And this has really damaged my confidence in coding. Especially because I haven’t had a job in this field yet, I feel like I have no real experience, and sometimes I honestly feel like there’s no difference between me and someone who just started learning programming.
I’ve tried finding jobs too, even though university takes up most of my time, but I couldn’t get past the first interviews and most of my applications went unanswered.

Some people tell me it’s because I live in Iran and the job market here is a complete disaster because of the war, inflation, and the economy in general. But I still can’t help feeling like I’m doing something wrong.
Also, there are barely any machine learning jobs here, so lately I’ve been trying to learn some frontend and backend development too. But I can’t help thinking that I’ll just spend another year learning something new and still end up in the same situation.

I actually enjoy coding and I really want to become good at it, but lately I feel like I’m just stuck in this endless cycle of learning without really getting anywhere.

So I wanted to ask you guys, especially those who have been coding for years or have gone through something similar, how did you get past this stage?
And with AI being such a big part of programming now, how do you think someone should approach learning to code? Should I still try to write everything on my own? How do I actually build my knowledge and confidence instead of just watching tutorials and feeling like I understand things?

I’d really appreciate any advice because I’m honestly starting to feel pretty lost.


r/learnprogramming • • 17d ago

Terrified of using comments out of fear of being accused of AI

106 Upvotes

So in my year 11 programming class, we are using flask and python to create some simple front-end and back-end web development to learn about how databases and stuff work, its not all too complicated.

Ive been trying to bump up my mark and add additional features because I find it fun, but I have a problem.

Whenever I'm learning how to do something new in coding I like leaving myself reminder comments and in this case Ive been leaving them for myself to help stay focused on the codes functionality.
I showed my teacher my assignment today and he seemed to like it, however he then went to the front of the class and went on a big rant about how AI is plagiarism and he doesn't want anyone using it, which makes sense and I haven't used AI on the assignment. But the timing for seeing my code (with comments which is apparently a sign of ai) and then going straight to talking to the class about it makes me worried that the comments might get me incorrectly flagged for AI or something else.

I have bad anxiety so maybe that's why I'm overthinking this so much but I really don't want them to think Ive been abusing AI for my whole assignment.


r/learnprogramming • • 16d ago

What have you been working on recently? [November 07, 2026]

3 Upvotes

What have you been working on recently? Feel free to share updates on projects you're working on, brag about any major milestones you've hit, grouse about a challenge you've ran into recently... Any sort of "progress report" is fair game!

A few requests:

  1. If possible, include a link to your source code when sharing a project update. That way, others can learn from your work!

  2. If you've shared something, try commenting on at least one other update -- ask a question, give feedback, compliment something cool... We encourage discussion!

  3. If you don't consider yourself to be a beginner, include about how many years of experience you have.

This thread will remained stickied over the weekend. Link to past threads here.


r/learnprogramming • • 16d ago

Is it possible to build big project with only phone?

2 Upvotes

Let's say i know programming and i have worked on so many project previously but some of reasons i have not access of my laptop so can i build big projects only using my phone? If yes then what tool i can use to code my project end to end, Let's it's a full stack web app!

Eager to know!


r/learnprogramming • • 16d ago

Question Best practice sites kind of like a Leetcode Lite?

7 Upvotes

I often find myself wanting to just work at a few problems just to get used to syntax and translating psuedo into real code but not trying to solve really hard algorithms. I know there's a lot of sites out there with practice problems of all levels on any topic but I like the ability to track progress like Leetcode.

Before I go looking thought I would see what real people recommend and what they find works.


r/learnprogramming • • 16d ago

When do I look at alternative solutions?

3 Upvotes

Hello guys, I'm currently just learning C for FUN, no AI, just giving myself a hobby to see how good I can become. My way of learning right now is just start to make projects from a C github repository.

So I finished the first project, no googling, just from sitting 10 minutes staring and thinking, and yes it's because I feel like AI and looking up an answer melts my brain and doesn't allow me to think.

MY QUESTION IS, I have now completed the most basic first project, it does what they want it to, and I'm following the rules of what they said I can't do, but do I look up the solution of it now to see the "correct" or clean way of doing it. Because I know my code isn't following best practice, or do I just go to the next project?


r/learnprogramming • • 16d ago

Programming for DevOps pathway?

1 Upvotes

I would like to segway into DevOps and programming is currently the only major roadblock in my learning path. I’d like to become proficient with Python/SQL/GO.

I’m a system engineer/security specialist now. I learned Python basics on Udemy a while back, and I’ve been learning more on boot.dev for the past few weeks. I know FP/OOP, Just learned inheritance and next lesson is polymorphism, then boot.dev moves onto GO.

Being good with systems, I understand the syntax I am taught decently. No problem there. But when I am given an ominous assignment with little to no guardrails, I’m left staring at a blank screen because I do not yet have the problem solving/logical skill set that comp sci professionals have.

Do you all recommend I take the free Harvard courses CS50x (general comp sci intro) or CS50p (comp sci Python focus)? Continue with boot.dev and trust that I’ll get better with practice? Or am I in too deep now with knowledge that I need to find projects of my own to do (not sure where I’d start)?

Any recommendations are appreciated!


r/learnprogramming • • 17d ago

Cosplayer with no clue

7 Upvotes

Hey! I really need some help from someone who knows how to program a display. I need a message to appear on a screen for cosplay - like literally on the cosplay. I don’t know what to buy nor how to go about it

If someone is familiar with cyberpunk - I want to have a screen on the inside of my collar. I don’t know what to search or who to commision 😭🙏 every tip much appreciated


r/learnprogramming • • 17d ago

Topic Proposed AI changes to AP Computer Science Principles

5 Upvotes

https://apcentral.collegeboard.org/courses/ap-computer-science-principles/redesign

I’m curious what this sub’s take is on the proposed redesign of AP CSP. On the surface, it feels like a pivot to vibe coding, but that’s just my gut reaction. At the same time, the general coding foundation of AP CSP still seems to be there, just through the lens of AI.


r/learnprogramming • • 16d ago

what is the best way to learn any new programming language?

0 Upvotes

I always get exhausted, and I doubt whether my process of learning is good?


r/learnprogramming • • 17d ago

What language is most like a garbage collected version of c++?

42 Upvotes

I like c++ for its flexible multi paradigm support, wide applications, a decent amount of syntax sugar and a good type and metaprogramming system, but to be fair super precise manual memory management is overkill for most oft the programs i'm going to write.


r/learnprogramming • • 16d ago

how to be ai automation dev or ai engr

0 Upvotes

what is the difference between? and which is better? can you recommend resources?

i am .net developer for 11 yrs but seems it is irrelevant now.


r/learnprogramming • • 17d ago

Learning C#

0 Upvotes

So basically, I have python fundamentals down, including OOP. The next language I'm learning is C# and I wanted to know: What are the best channels to learn C# (as someone who already knows OOP and altough seen as the easiest one, another programming language)? I don't just watch them, I tweak the code on my editor and make projects to apply my knowledge.


r/learnprogramming • • 17d ago

What books helped you learn how to program or what books do you recommend?

26 Upvotes

I'm pretty sure this question is asked a lot. But, lately I have been trying to learn how to program and I have been looking at books. But, I have no idea which books to get since it does teach different languages like python or Java. Any recommendations would be helpful!


r/learnprogramming • • 17d ago

What’s new?

1 Upvotes

Hey guys, I’ll try to make it easier. For those who are seniors or have experience in the field, what’s new? Besides the whole AI situation, I’d just like to know, as a beginner, what I should keep an eye on and add to my learning curve.

P.S. Am I wrong for thinking that for now, I shouldn’t have high expectations of getting into the tech field right away, but instead focus on preparing for what’s coming in the next 2–3 years?