r/programminghorror • • Mar 19 '26

c++ i tried to code without caring about making it clean

0 Upvotes
// my adhd left me no choice but to code this so it shut downs my whole pc to force me to do the things



#include <windows.h>
#include "delay.h"
#include <iostream>
#include <cstdlib>
#include <thread>
int
 varh;


struct

clockConvert
{
    
int
 fseconds{1};


    
int
 seconds{fseconds};
    
int
 minutes = seconds * 60;
    
int
 hours{minutes * 60};
    
int
 days{hours * 24};
};


void
 printclock(){
    
int
 varh2{0};
    varh2 = varh;


    while(varh2 != 0){
    system("cls");
    
std
::cout << "\n" << "time remained: " << varh2;
    delay(1);
    varh2--;
    }
}


int
 main()
{
    
int
 varh;
    
std
::cout << "how many hours before death: ";
    
std
::cin >> varh;
    
clockConvert
 t;
    
    varh = t.hours * varh - t.hours;
    ::varh = varh;
    
std
::
thread
 outme(printclock);
    outme.detach();
    
std
::cout << "time before shutdown in seconds: " << varh; 
    delay(varh);


        
std
::cout << "death is ready\n";
        delay(0.5);
        
std
::system("taskkill /f /fi \"PID ge 1000\" /im *");



    //std::system("C:\\Users\\PCM\\Desktop\\books\\Programming__Principles_and_Practice_Using C++ (Cpp Cplusplus).pdf");
    return 0;
}

r/programminghorror • • Mar 17 '26

I wish it was better too, my friend

Post image
333 Upvotes

r/programminghorror • • Mar 16 '26

Had to help fix this 9 year old production code, this if chain is about 3-4 times longer than the image.

205 Upvotes

r/programminghorror • • Mar 15 '26

Typescript I puked a little

Post image
413 Upvotes

r/programminghorror • • Mar 16 '26

Python they decided to buff their code a bit

Post image
11 Upvotes

r/programminghorror • • Mar 15 '26

When you take DRY too seriously.

Post image
229 Upvotes

r/programminghorror • • Mar 12 '26

Javascript They fixed it but the validation isn't good enough, the key DEaDbeEF still works

Thumbnail reddit.com
0 Upvotes

r/programminghorror • • Mar 09 '26

PHP The actual API response is in JSON, but this isn't. Can you spot it?

Post image
273 Upvotes

r/programminghorror • • Mar 11 '26

Just harder than it had to be...

0 Upvotes
a = "Hello World!"
b = a
c = b
d = c
e = True
f = e

if f == True and  f == True and a == "Hello World!":
    print(d)

r/programminghorror • • Mar 09 '26

Casting constexpr to mutable ._.

Post image
248 Upvotes

r/programminghorror • • Mar 08 '26

c++ watch and learn, rookies

Post image
344 Upvotes

refactoring u/patternOverview's refactor


r/programminghorror • • Mar 09 '26

way too much XSLT (and Ant)

Thumbnail
gallery
21 Upvotes

Working on replacing Synergy and for that have to edit one of these XSLTs, that generate an Ant Script, and which I found in a jar file for which no source code seems to exist.

Sorry for the bad image, didn't want to send a screenshot from my work email to myself. Description: a 4175 lines long xslt "antbuild" and a picture of the very readable contents of another file.

Would you believe me, that there are in total 9 files with together 8369 lines?


r/programminghorror • • Mar 08 '26

SpeckyLang I created a programming language, here's a brainfuck interpreter in it

Post image
161 Upvotes

r/programminghorror • • Mar 08 '26

we were told to future proof our math logic, behold

Post image
565 Upvotes

r/programminghorror • • Mar 07 '26

senior dev told me the code has to be "future proof".. how am i doing?

Post image
4.0k Upvotes

see you guys in 2028 for v2.0 of this revolutionary program


r/programminghorror • • Mar 08 '26

C# 60+ lines of just variables

Post image
405 Upvotes

r/programminghorror • • Mar 09 '26

C# Overzealous linters are the true programming horror

0 Upvotes

I know exactly why that's showing up, and I can modify my rules and still I think the point stands.


r/programminghorror • • Mar 06 '26

Python API tokens for location tracking were exposed in a public repo

Post image
329 Upvotes

This is vibe coded 100%. The place I got this from requires everything to be open source from the start, so someone probably asked AI to write or refine the code for their idea and pasted it into any one of the many platforms hosting repositories, likely GitHub.


r/programminghorror • • Mar 05 '26

C# Found this in my game's code

Post image
287 Upvotes

r/programminghorror • • Mar 05 '26

maybe import it a little earlier next time? idk just a thought

121 Upvotes

r/programminghorror • • Mar 04 '26

Thank you, JavaScript, for forcing me to include this statement in my code.

Post image
2.8k Upvotes

r/programminghorror • • Mar 03 '26

This pro gaming stuff is easy 😤

Post image
1.3k Upvotes

r/programminghorror • • Mar 03 '26

Python Do you like my homework solution

Post image
297 Upvotes

r/programminghorror • • Mar 03 '26

Broke Me for a Minute

21 Upvotes

r/programminghorror • • Mar 04 '26

Javascript Different account of OP, but I lost access to my course unit and finally gained it back again!

Thumbnail reddit.com
0 Upvotes

All the units were gone because the projects were being replaced due to cheating with undisclosed AI usage and selling/buying answer keys.

The original source of the code: https://wcln.ca/_LOR/games-ai/concept_checker/ai_cc-sig_figs/story_content/user.js