your code is a trainwreck, so I ignored it to give you a simple example.
you have freestanding code that looks like it should be in main, and main is an empty line off by itself, you have random [ ] around stuff, ... it needs some work.
lets take one idea though.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
void registr(string ®user_p)
{
... code
cin >> reguser_p;
... more code
}
void login(string ®user_p)
{
if( reguser_p == something)
//whatever, use the variable
}
int main()
{
string reguser;
registr(reguser);
login(reguser);
}
|
that is the format. you can send as many parameters to a function as you need to with commas: void foo(int &x, double &d);
the idea is that the 'data' really lives in main, in the 'reguser' variable.
you pass that to registr, and it gets read via cin, then when that is done, the value in main has been updated. Now you send that updated value to login, which does something else with it, and so on.
the names of the parameters can BE the same as the name in main. I put that _p on it to tell it apart on purpose. If you choose to use the same names, it will be hard to debug and you will confuse yourself if you are not careful.