As this is my attempt to code a console application, and by far my longest code yet.
My code is kinda messy and kinda janky to achieve the desired result.
It would be glad if someone can review my code, and suggest how to improve it(to be on par with average company programmer). Ty in advance :)
Coded using devcpp, windows.h and fstream is used for system() and writing text file.
Is system() and Sleep() calls bad because it's resource intensive? Or is it because of platform restriction? Another thing i've learned about Sleep() is bad because it lets the computer doing nothing, purely for viewing use/diagnose only, so i'll try to avoid that. But is there any other recommendations/alternatives for creating a reciept, viewing jpegs?
goto statements are easier to use/implement in some cases, but creates a lot of confusion when i try to code so i kinda get it. They are mainly use for going back to previous menu.
And i did a really bad job of naming things as the program gets bigger.
The functions' tasks are too specific because i'm going to label one function for one menu option, but with more functions, the complexity gets higher.
Is system() and Sleep() calls bad because it's resource intensive? Or is it because of platform restriction?
Yes, both.
goto statements are easier to use/implement in some cases, but creates a lot of confusion when i try to code so i kinda get it. They are mainly use for going back to previous menu.
You need to forget you ever heard of goto, there are other much better loop constructs. Like while() do{}while() and for(;;) learn to use these loop structures along with small simple functions. The goto statement makes following the logic of your program much more difficult and should only be used by very very experienced programmers IMO.
The functions' tasks are too specific because i'm going to label one function for one menu option,
That's not too specific IMO, that is a good practice.
but with more functions, the complexity gets higher.
No when done correctly using properly named functions that do one job well actually will reduce complexity by allowing you to reuse many of your functions.
By the way when ever I see case statements that require braces {} for proper operation I usually put the body of that case statement in a function. And any time I see switch statements inside switch statements I think it's time to reconsider my logic, again functions may come into play. And lastly (for now) any time I see my indentation level going over 3 levels I think it's time to reconsider my logic.