Struggling with a Probability Program in C++ for My Film

0
8
Asked By CinematicCoder92 On

I'm in the preproduction phase of my Experimental Short film and decided to write a C++ program to help with the plot. I studied C++ for Unreal Engine about 5 or 6 years ago, so I'm somewhat familiar with it. I'm trying to create a simple probability program that generates numbers related to the fine structure constant (1/137). When I enter the "run" command, I want it to produce certain numbers, and after a specified number of runs, it should output custom text.

Specifically, I'm aiming to generate three different text outputs after certain intervals. For example, if I run the program 10 times, I'd like it to show the first custom text once in the sequence of random numbers, then have 5 additional runs of just random numbers, and after that, display the second custom text once. The same goes for the third custom text.

I've had to restart my project multiple times in Visual Studio Code, and even used GitHub Copilot to get help, but I still can't get it to work how I want. I'm even considering starting from scratch instead of trying to edit what I have. I'd appreciate any guidance—I could really use some support, especially since AI hasn't been very helpful for me!

3 Answers

Answered By RandomThinker88 On

Are you thinking about whether to have the program wait for keyboard input between runs? That could simplify things. If it waits for input, you can keep the output straightforward without needing a complex setup for multiple runs. This way, you can just have a single loop that handles everything. Just remember to set up clear conditions for what happens after each run!

Answered By TechNoob22 On

From what I gather, you want to ensure that each run produces distinct results without repeating your custom texts too early. A suggestion would be to separate the custom text logic from the random number generation. Maybe a switch-case structure could help control when to display each custom message based on how many runs you've completed—this might help you get closer to your intended output.

Answered By CodeWizard101 On

It sounds like you need to structure your code a bit differently to manage the outputs. You might want to create a loop that keeps track of how many times you’ve run the probability generator and check against that to decide when to display your custom text. For instance, use a counter that increments every time you run the program, and once it hits your target, you can insert your custom text. Make sure to reset the counter after it’s displayed your text for that run, just to avoid multiples.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.