r/badcode • u/KirbzYyY • Jan 02 '22
c++ Was going through some old files, found this, not 100% sure if it qualifies (approx. from 6 years ago, when I started learning C++).
98
Upvotes
r/badcode • u/KirbzYyY • Jan 02 '22
11
u/[deleted] Jan 02 '22
using namespace stdtho5
u/KirbzYyY Jan 02 '22
Thanks for the feedback, I switched universities and will have a programming course again and ran into this while looking for my old materials, wanted to know how I did back then.
4
u/joza100 Jan 02 '22
I see Croatian?
55
u/Nahuatl_19650 Jan 02 '22
Sir, this isn’t bad code. It is the imaging of greatness in the making. Save it and be proud.
34
u/jddddddddddd Jan 02 '22
Nowt wrong with that. Looks a bit cluttered, but C++ always does IMHO.
16
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jan 02 '22
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
17
u/hellra1zer666 Jan 02 '22
Honestly, it's not bad code, especially considering it is beginner code. A bit roundabout but that's it. The only "bad" thing is that you don't close the stream in index_check. You could argue the usage of globals is not nice, but that's it honestly.
6
u/veselin465 Jan 02 '22 edited Jan 03 '22
Actually, it doesnt look bad. I would have probably done something like that in the past, too. Just to note:
needto close the ifstream in the index_check function (it's actually not needed since the desctructor will close it, anyway, my bad)3
u/[deleted] Jan 03 '22
I’ve seen worse!
2
u/Knuffya Jan 02 '22
Coding style: null
1
u/Dantharo Jan 03 '22
br huehue
1
u/babalaban Jan 10 '22
Dude, it looks like a great code of someone who tries to upgrade oneslef from plain c to c++.
Sure, there's a lot of room for improvement, but isn't it great when you can come back to your old code and re-make it using your current knowelage and contrast the two?
0
u/[deleted] Jan 04 '22
[deleted] — view deleted comment