So, I just decided to try picking up C++ programming as a hobby. I took a Java-based programming class back in high school, so I have a general idea what I'm doing (or so I think).
The program i made runs, but
A) it's very sloppy-looking (and I apologize for that).
B) it's really not practical "as-is" -- I would really like the password to be stored somewhere outside of this program. I'm not really sure how to do external references (or, if it's possible).
I'd love help w/ the "password" reference. I would really appreciate any general comments/critiques for how to make my programs look nicer/make more sense to viewers.
___________
Code://"Password program" //this is a simple program I am using mostly just to learn/practice C++ // someday I might actually use this to pass-protect stuff maybe? (idk) #include <iostream> using namespace std; int main() { string password = "Pass"; //I really want to find a way to recover this variable //from some remote file/program/class named "Server" string entry; cout << "\n Welcome "; cout << "\n Please enter your password \n"; cout<< "password:"; getline(cin, entry, '\n'); while(entry != password) { cout <<"Invalid password, \n Please re-enter your password. \n"; getline(cin, entry, '\n'); } cout << "Verifying... Welcome \n"; //This would be pared with an if statement // so as to either begin or exit a program return 0; }



LinkBack URL
About LinkBacks



