I'm using the Elegoo Uno R3 Arduino shield with the Atmega328P microcontroller. It has a USB port on the shield, which lets you power on the board and/or program the microcontroller by connecting your computer to it. I'm not sure how to connect the controller to your PC if you're using a standalone microcontroller without the built-in USB port.
It's not too complicated. You need to install some packages through your terminal to communicate with the microcontroller. You need to install avr-libc, avrdude, binutils-avr, and gcc-avr onto your computer by using terminal commands (exactly how its installed depends on your OS, ie. "gcc-avr" or "avr-gcc" - this is also written in C, so if you're using C++ or another language I believe a couple changes to the names of the packages is all you need). You can look online as well to figure out how to do it on your OS. There are some tutorials, but you may need to do some digging on the web to find them.
These are the commands I use for MacOS to flash the text file onto the controller:
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328P -c -o file_name.o file_name.c
avr-gcc -mmcu=atmega328P file_name.o -o file_name
avr-objcopy -O ihex -R .eeprom file_name file_name.hex
avrdude -V -F -c stk500v1 -p atmega328P -P port_serial_name -b 115200 -U flash:w:file_name.hex
Change the "file_name" to whatever the name of the text file the code is on and
remember to save the text file to the format of the language youre using
(file_name.c for C, file_name.cpp for C++, etc.)
Also, change the "port_serial_name" to whatever port name the USB cable is
connected to for the board. Look through the system settings on your pc to
figure out which port the USB cable in connected to.
Also, here's a link to a YouTube video I used that explains what each command does in the above snippet (he's using Linux, FYI). He explains it at around minute 4:30. There are other videos/online resources you can find that also do the same thing, but again, it may take some looking because they aren't usually the top search result.
Install the packages, write your code like normal in a text file (I use TextMate on my MacBook, but you can use any texteditor you want), save it with the file extension of your programming language, navigate to the saved file through your terminal, then use the commands to put the file onto the controller. Any time you want to upload the code onto the controller, just put in that command (or save it) and it works.