Program

Hello everyone, first off i would like to point out that i am new to the forums, and if this is in the wrong plqce i would appreciate if you would let me know, now on to buissiness...

I had an idea for a program i would like to make in C++ (I use Code: Blocks to compile).

My idea is a program where the user runs it, and the first thing it will say is "Enter password: (Q if you dont have account)" then the user will press Q and it will say "Create Password: " then user will type a password. After that, i want the program to save that password so that when the user opens the program up again it will ask for password, and user will type the pass they just made and they can log into a program that lets them write anything they want, and if they press Q and S at the same time, it saves what they typed, so that when they close the program and open it back up, then log in, all that they typed will still be there, now when they type password but s not what they registered in the begining, it will tell them that it is wrong and then it will ask for pass again, and it will keep doing this until they get it right, now i need help with this.

I dont know how to make the password work the way i described it and i dont know how to make it save the pass, i also dont know how to make it save the text they typed. Please someone help me.

And yes this is just basicaly notepad but with a pass to make it more private
To hide your input echo (as in the case of a password) you need to actually read the keyboard events/presses as characters, not using the input stream cin. For this you need a library. I would assume a native library exists for your OS that will let you do this; just run a google search. The same technique would be needed to detect simultaneous key presses (as in your case of "both Q and S at the same time.") As for reading and writing to files, you need to use file streams. Look up "fstream" on this site, the C++ STL has what you need for that.
Hello~~I'm also new to this forum.
In addition to Mathhead200's reply, I think you might need a file to store your encrypted password.
When you run the program, it first checks whether this file exists, and if so, it requires the user to enter password, otherwise, it may accept a 'Q' and create the file.
About the saving part, operate on buffers and write the buffer to a file when a 'QS' is pressed.
Good Luck and Have Fun:)
Lol i can already tell this is gona be alot harder than i originally thought, but not by much.

P.S : what is a "buffer" and i still dk how to make files
Buffer is a block of memory. It could be a dynamically allocated array or a vector.
I don't down whether you want to use plain text files to store what you have typed or you want to your own specified files to store it.
I think it's more important to make it run first, so use plain text files because it's easier.
By the way, what's your OS?
Good Luck:)
Last edited on
CPlusPlusCreeperReaper: tell me what you want in a more abstract way, and maybe I can help you get something coded that satisfies what you want (or need), but in a different (hopefully easier) way... How much C++ and/or programming experience do you have?

PS: I wasn't trying to scare you off, but you asked how to complete a task and I answered. Like I stated above, if all you want is a password protected notepad (or something more like "edit", "vi", ...), I can help you with that. However, if you want suppressed echo, encrypted files, etc... Your program will be much more complicated.
Last edited on
Mathhead200: Actually It's not me who wants to complete this task, it's CPlusPlusCreeperReaper. After all, thank you for your advice, it's helpful to me. I don't have much experience on programming, but I like it.
Good luck and have a nice day:)
Last edited on
Lol, sorry about that. Copied the wrong name.
Topic archived. No new replies allowed.