cout << "Enter Your Username: ";
cin >> Username;
cout << " "<<endl;
extern string Username = extern string user; //takes the username and sets it to user
extern string user = string USR; //takes usr and sets it to USR
if (Username = USR){ //if username is usr (if the username is what you registered to be)
cout << "Enter Your Password";
cin >> Password;
cout << " "<<endl;
}
-------------- Build: Debug in MainFrame ---------------
Compiling: main.cpp
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp: In function 'void login()':
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:12: error: 'Username' has both 'extern' and initializer
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:12: error: declaration of 'std::string Username'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:6: error: conflicts with previous declaration 'std::string Username'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:12: error: expected primary-expression before 'extern'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:12: error: expected ',' or ';' before 'extern'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:13: error: 'user' has both 'extern' and initializer
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:13: error: expected primary-expression before 'USR'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:13: error: expected ',' or ';' before 'USR'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:14: error: 'USR' was not declared in this scope
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:13: warning: unused variable 'user'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp: In function 'void reg()':
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:35: error: 'user' has both 'extern' and initializer
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:35: error: declaration of 'std::string user'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:24: error: conflicts with previous declaration 'std::string user'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:35: error: expected primary-expression before 'Username'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:35: error: expected ',' or ';' before 'Username'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:36: error: 'pass' has both 'extern' and initializer
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:36: error: declaration of 'std::string pass'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:25: error: conflicts with previous declaration 'std::string pass'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:36: error: expected primary-expression before 'Password'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:36: error: expected ',' or ';' before 'Password'
/Users/rabbiandrewbloom/Desktop/C++/MainFrame/main.cpp:37: error: 'mainframe' was not declared in this scope
Process terminated with status 1 (0 minutes, 0 seconds)
20 errors, 1 warnings
what im trying to do is set the username and password in login() to mimic the ones set in reg() (i want to make it transfer over so you can set one in reg() and use it in login() but im getting errors)
Well, I would read the documentation, and read the stuff about object-oriented programming, and classes and such. I would then create a class which contained the username and password (perhaps encrypted if you are able to), and then your functions could pass variables of that class type around as arguments, and use those.
I'm not gonna write all that out for you, because this is a help forum, not a code request forum. Read how to use C++ in the documentation. Learning new features of the language and practising them is the only way forwards.
EDIT: You could even work out a way to get the user data stored in binary format in files. You just need to get used to the C++ language first.