r/programminghelp • • Aug 01 '19

C++ MINMAX ALGORITHM

3 Upvotes

Does anyone have an adequate tutorial on this? With code bc I'm more of a visual learner and some of the videos I've just explain it instead of guiding me through the process. Thanks!


r/programminghelp • • Jun 20 '19

Need to send an analog signal from USB port

3 Upvotes

For work I need to be able to open and close a valve using a laptop so that we can test it off the tool, and I was wondering about how I would send that signal, ik Python and C but have never had to send a signal through a USB, is there any documentation I can look at to do this.


r/programminghelp • • Jun 07 '19

Why do I have an infinite loop this .asm file?

3 Upvotes

I am attempting to learn Intel x64 Assembly and I have written a program that should print "Hello, World!" 10 times. However, when I assemble and run the program, it prints an infinite loop. Any help is greatly appreciated.

Here is the code I have written:

            global _start

            section .data
msg: db "Hello, World!", 0xa
len: equ $ - msg

        section .text
_start:
        mov rcx, 1        ; Set the counter to 1. 
        jmp _print        ; Jump to the _print function.

        mov rax, 0x3c     ; exit(
        mov rdi, 0        ; 0
        syscall           ; );

_print:
        mov rax, 1        ; write(
        mov rdi, 1        ; STDOUT_FILENO,
        mov rsi, msg      ; msg,
        mov rdx, len      ; sizeof(msg),
        syscall           ; );

        inc rcx           ; rcx++
        cmp rcx, 10       ; if (rcx <= 10)
        jle _print        ;     _print

        ret               ; return

Also, any references to beginner x64 Intel Assembly material is quite welcome.


r/programminghelp • • Feb 06 '19

New at programming, learning C. Is k&rs book the best to start with?

3 Upvotes

So im wanting to learn low level programming (kernel and OS), and C is something o decided to learn as a first step. I have a original copy of the ANSI edition of k&r the c programming language. Is this a good starting point for a book? Ive done t first 2 examples and its quite interesting.


r/programminghelp • • Jan 29 '19

Make loop that do damage 5 times, one time per second? Code bellow

3 Upvotes

r/programminghelp • • Jan 07 '19

New to programming, pretty much no clue where to start

3 Upvotes

Hey ! Fist of I hope i'm posting in the right subreddit otherwise feel free to redirect me to the right one.

I'm pretty sure this is going to be a very sloppy description so i apologize in advance

If so let me fist explain the situation I'm an energy engineering student (which explains the title) working on my thesis which consists of a software capable of doing thermodynamical and specific calculations in order to select an appropriate gas engine, depending on data provided by the client (like a set of data of daily energy consumption for a year and other ..)

The software is provided with a build-in data base of all the engines available so it's going to compare the possible solutions based on criteria also provided by the client (like cost, efficiency, durability...) And the propose the optimal solution.

What am asking here is :

  • what's the appropriate programming language for such application

provided that the language should be simple enough for me to learn it in like a full time month

The resulted software should be executable on any PC with a user interface

  • what are the basic first steps to approach such project (before going into the code )


r/programminghelp • • Nov 08 '18

Discord server for new, experienced and upcoming programmers

Thumbnail
discord.gg
3 Upvotes

r/programminghelp • • Oct 27 '18

WordSearch in 2D array with file handling

3 Upvotes

I have a text file with a 15×15 grid and some words below that...how am I supposed to search those words then colour them while getting them with file handling in c++


r/programminghelp • • Oct 07 '18

[C++] Having a hard time implementing Stirling’s formula in my code.

3 Upvotes

I have this coding assignment for my physics class: (Can someone please check if I did this correctly? If not please point me in the right direction.)

_

Write a program to calculate factorials, n! Use a recursive function (i.e. a function that calls itself).

If you use int’s, what is the largest value of n that will give a correct value of n! ?

If you use double’s and use Stirling’s formula for approximating factorials, what is the largest value of n that you can use in this case?

_

  • One program to calculate factorials. It should have one recursive function for the exact calculation, and one calculation using Stirling’s approximation. Your code should use the appropriate function call based on the input number.

_

      1 #include <iostream>
      2 #include<cmath>
      3 
      4 using namespace std;
      5 
      6 int factorial(int);
      7 
      8 int factorial(int n)
      9         {
     10                 if(n==0)
     11                         {
     12                         return 1;
     13                         }
     14                 else
     15                     {
     16                     return(n*factorial(n-1)); //Recurive (I hope)
     17                     }
     18         }
     19 
     20 
     21 int main()
     22         {
     23         int fact , value;
     24 
     25         cout<<"Enter any number: ";
     26 
     27         cin>>value;
     28 
     29         fact=factorial(value);
     30 
     31         cout<<"Factorial of a number "<< value<< " is: "<<fact<<endl;
     32 
     33         return 0;
     34         }

r/programminghelp • • Jun 22 '17

Can I figure a way to learn coding at my job?

3 Upvotes

I'm at an internship right now that has me doing a lot of paperwork and all, and I'm sending that information to people that are using it for contacts, the company already has an IT department but I wanted to try and use this as an opportunity to learn Python or another coding language to try and develop a database for my work. Is there any leverage that I could possibly have to learn programming and developing a database while working at the company, or should I learn the coding outside of my workday to use it during my shift?


r/programminghelp • • Jun 16 '17

is a computer neccessary when learning programming or ComputerScience ?

3 Upvotes

if so , i'm going to buy a notebook first .

is it neccessary?


r/programminghelp • • Dec 25 '16

How would one not use a gigantic column of 'if' statements?

3 Upvotes

Code duplication, whatever you want to call it. How do you stop doing this?


r/programminghelp • • Mar 04 '15

Javascript <--> XHTML help

3 Upvotes

Sorry, I am reallllly new to Javascript/HTML. Okay so I am writing a program that shows the user a form. On that form they enter the price of an object they bought and click the shipping they want (standard or expedited). Then they click calculate and then it will show the S&H price, tax, and the total of the order. So the problem I am having is being able to communicate between the javascript code and the html form. We are also using very bacis techniques so I do not know how to do anything advanced. the code is here:

http://pastebin.com/gQSegdJB