i wrote this a couple of years ago when i was just starting to program. i didnt know any professional programmers and wanted to learn, so just experimented with the language. maybe it will give you an insight into how people program for fun. feel free to add to it, debug it, or fix some of the algorithm-shy functions. it would be nice to know what people think of my programming style back then.

alex

looked inside and its pretty useful for some beginners.

Not bad!

Critique...

I didn't run it. I don't have Dev C++. Few people do. I saw the README hoping for some guidance on how to build it since I tend not to double click executables. The README was good. The "Under 18" stipulation also applies to "Over 18 and at work or some other place". We'd all do well to have some situational awareness so it's good to have the warning.

Then I saw something called "makefile". I was hoping I could build it there. But it wasn't a "makefile" as we think of it. It was just another C++ file. Consider wrapping the whole thing up in an actual project that we can open with Code Blocks or something modern and explain whether there are Windows-Specific headers. You mentioned you created it on Windows, but didn't mention whether we were required to use Windows ourselves. That all goes in the README. But as least you HAD a README! And you put some good stuff in there. But you forgot to list what the programs do! We have to look at the actual code (or run it) to see.

Now to the code...

You are possibly re-inventing the wheel. There is something called "struct tm" as well as the ctime library that does much of what you do in atime.h. Perhaps those did not suit your needs or perhaps you did not know about them at the time or perhaps you just wanted to practice. But you wrote a lot of code that's in the C++ libraries (and by doing so, you sacrificed portability for no real gain as far as I can tell).

There are quite a few "if...then" statement strings that could be changed and consolidated into smaller code. The code could be much smaller with arrays, vectors, maps, whatever, and the codes with the questions are sprinkled into the rest of the code. You should instead encapsulate stuff like the questions and answers into a class.

As far as file copying, what about non-text files? You can use "read" and "write" and just copy the bytes themselves. That way things wouldn't crash if you try to copy, say, a JPEG.


Anyway, quite good for someone just learning, and much of what I mentioned is probably stuff you now know.

Another comment. This one's quite important (I think). From a security standpoint, you don't store passwords in a file. If you ever register on a forum or anywhere else, lose your password, click "Forgot My Password", and if anyone EVER actually SENDS you you your password, run like hell because that should never happen.

Passwords should never be stored anywhere and should never be recoverable. You need to develop a hash function (or use someone else's like MD5, though it has a few vulnerabilities). The person creates a password, you hash it, and store the hash. Then when they log in, if they use the right password, the hashes will match and you let them in. The hash value is worthless by itself and there's no way to get from the hash back to the password or to figure out what was typed that produced the hash value, so if someone steals your computer, they can't get the passwords. Even YOU don't know the passwords (that's why you have to "reset" the password again).

It doesn't matter for something like what you did, but it's best to learn the right way in case you ever need to set up security.

Thanks for the feedback. Yeah i didnt know what a makefile was back then, and thought it would be an appropriate function name. my knowledge of c++ libraries was very limited - i had access to a single book, which i was using to grasp basic concepts such as functions. youll notice i have not used a single pointer or reference throughout.

it is purely playcode and maybe if i get the time ill do some more to fix it up a little.

I thought it might be interesting to share with others especially beginners who want to see some ways which you can play around with code - i remember getting to a point where i was desperate to find simple code i could mess around with.

Thanks for the feedback. Yeah i didnt know what a makefile was back then, and thought it would be an appropriate function name. my knowledge of c++ libraries was very limited - i had access to a single book, which i was using to grasp basic concepts such as functions. youll notice i have not used a single pointer or reference throughout.

it is purely playcode and maybe if i get the time ill do some more to fix it up a little.

I thought it might be interesting to share with others especially beginners who want to see some ways which you can play around with code - i remember getting to a point where i was desperate to find simple code i could mess around with.

It's really cool, honestly. I wanted to make a small program like that, but you're just too advanced compared to me. :(

I really do wonder how you made the program though because I could never pull that off....

If is a very useful statement in C. it implies that if a certain condition is fulfilled, the following statement should be used.

I wanted to make a small program like that

All computers have resources. start small, just working with getting input from the user and displaying things on screen. after that, think of some calculations to do on that input and then changing the flow of the program depending on the result. if you are a creative thinker, before you know it you'll be lost in code with more ideas than knowledge which will give you the drive to learn.

All computers have resources. start small, just working with getting input from the user and displaying things on screen. after that, think of some calculations to do on that input and then changing the flow of the program depending on the result. if you are a creative thinker, before you know it you'll be lost in code with more ideas than knowledge which will give you the drive to learn.

Actually, no. However, I have great ideas for major programs but for small ones I can't come up with any useful ideas/plans to write the code in that fashion.

That's why I get stuck at and fail writing small codes but have massive ideas.

In other words, you're completely incompetent. Massive ideas but an inability to follow through with them makes you utterly valueless. Then again, you're very obviously a troll who has no interest in following through with massive ideas. Rather, you're simply trying to get jollies out of wasting people's time.

commented: Just bc we all love trolls. +1

In other words, you're completely incompetent. Massive ideas but an inability to follow through with them makes you utterly valueless. Then again, you're very obviously a troll who has no interest in following through with massive ideas. Rather, you're simply trying to get jollies out of wasting people's time.

No, I'm not. I'm here for advice and help. I know it may seem like I'm trolling because I fail to understand things so often, but that's just a problem I have; I learn hard.

I don't learn any thing easy, and it usually takes me a LONG time to learn and understand things, even put right in front of my face and explained thoroughly.

But nice to hear another person make a false accusation about me. :P

PS: Any help with a snake game, PM me.

>>I don't learn any thing easy, and it usually takes me a LONG time to learn and understand things
I had a friend who was just like that. He couldn't learn a thing without a _huge_ amount of explanation. Not so long ago, he went to a doctor and they discovered that a slight displacement of his jaw (probably due to a silly accident earlier in his life) had impaired the blood flow to his brain. Since they corrected the positioning of the jaw, he's a whole new person. True story.

If you think you might be suffering from a similar problem, a trip to the doctor might change your life. And I mean no offence by saying that, it's for your sake only.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.