You have nine strings in your program. If you mean what type variable should you have, the answer is "string".
You have nine strings in your program. If you mean what type variable should you have, the answer is "string".
Code:std::string ms; ms = "string"; std::cout << ms;
I update the code. Is it a good layout?
Looks good, except the outer switch could be just an if else.
And what does password do?
Password does nothing. I originally put it in there because I thought i needed it but it is unnecessary.
Can I suggest this to you when you have time? It's good to know. You're making progress. But you could make a little progress in more than one area!
Hmm... So where in my code do you think I should work on spacing? The second switch should be more indented?
Ah I see. Thank's, I dont know very much on code etiquet since I just started. What I envision for this program, which I am still working on, is a program which when started will ask for a master password and then will ask for how many passwords you want to save then ask for the name of each so like "Email" and then ask for the atucal password. Im currently looking up File I/O so I can figure out how to write to and create text files out of the program. Also, I was wonerding, Is there a way to encrypt files? Like say each of the passwords are stored in a file outside the program like a text file. Is there a way so that only the program could access the files so that not any one could just go in an open up the file.
There are many algorithms for encrypting stuff, but some of them are quite complicated to implement. When you are done with this program i'd suggest you look up XOR-encryption, it's very easy to implement, it is often used for teaching C/C++ (So it's easy to find tutorials on it), but the security lacks a bit compared to other algorithms, like RSA or AES.
Security is good enough for something like this i'd image though. Even though it is not invincible, XOR still takes alot of effort to get through, so if you just want to keep people out, it'll do fine..
How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.
Yeah, thanks, Ill look into that. Im not like encrypting like SS numbers or stuff.
Hm, would it be more logical to store all the passwords and password names in one file or is that hard to access and should be in all seperate files like:
master_password.txt
first_password.txt
first_password_name.txt
This is a code I guess i could use to edit the variables in outside files, tell me how it looks:
I know the do { isint spaced because It takes to much time.Code:#include <iostream> #include <fstream> using namespace std; int input; std::string master_password; std::string first_password; std::string second_password; std::string third_password; std::string fourth_password; std::string first_password_name; std::string second_password_name; std::string third_password_name; std::string fourth_password_name; int main() { do { cout<<"\n"; cout<<"1.Edit Master password.\n"; cout<<"2.Edit First password name.\n"; cout<<"3.Edit First password.\n"; cout<<"4.Quit.\n"; cout<<"What would you like to do: "; cin>> input; switch ( input) { case 1: { ofstream myfile ("master_password.txt"); cout<<"Enter the master password you would desire: "; cin>> master_password; myfile << master_password; myfile.close(); input<< 0; break; } case 2: { ofstream fpnfile ("first_password_name.txt"); cout<<"\n"; cout<<"\n"; cout<<"Now enter the name of you first password i.e.'Email': "; cin>>first_password_name; fpnfile << first_password_name; fpnfile.close(); input<< 0; break; } case 3: { ofstream fpfile ("first_password.txt"); cout<<"\n"; cout<<"\n"; cout<<"Now enter the atcual first password: "; cin>>first_password; fpfile << first_password; fpfile.close(); input<< 0; break; } } } while ( input !=4 ); }
Not if you have a proper editor. It's not etiquette, as the article explains it very well. It's about code readability. It helps others understand your code and it helps you avoid bugs.
For example, in Visual Studio, this is a cinch to do. Just select all the code and press tab and all the text you selected will be indented once more. That goes to show it's not difficult. There may be a similar button in other IDEs as well.