TightCoderEx wrote: |
---|
What I'm looking for is, can this code be improved, especially in regard to optimization. |
In 90% of cases you should not worry about optimization - get some good, well-designed code first, and only optimize it if you find that it is a bottleneck. Never pointlessly optimize code.
As for structural and design improvements, here are some points:
- if possible, you should avoid "using namespace std;". There are plenty of articles you can google about why - it's such a common topic that I get tired of explaining it.
- C++11 introduced new date and time classes so you don't have to deal with the old C ones - I'd recommedn learning them and trying to use them. Check out
http://en.cppreference.com/w/cpp/chrono
- You will definitely want to find a better brace & indentation style - I'm having a very hard time reading your code because of it. I notice that you are trying to line things up so they look nice - this is fine, but you should only do it if the things you are lining up are relevant. Currently you are lining up irrelevant things and it is confusing as to why they are lined up.
I can't say much more because I'm having a hard time readin your code with the indentation style you're using - the point of indentation styles is to emphasize the flow of code, and yours is preventing me from seeing how your code flows. I would have to spend a lot of time analyzing it or else reformat it myself, which is not good.