when I run the code below,This class is written for registration, will I get a segmentation error? what's the reason ? How can I fix it? Where's my code problem? I used c4droid in android please help.
#include <iostream>
#include <string>
using namespace std;
// registration class
class registration
{
public:
string signup ();
string signin ();
private:
string newuser, newpass,
user, pass;
};
// signup function
string registration::signup()
{
cout << " sign up :) " << endl;
cout << " please Enter username : ";
cin >> newuser;
cout << " please Enter password : ";
while (cin >> pass)
{
cout << " registration complete ;) " << endl;
break;
}
}
// signin function
string registration::signin()
{
cout << " signin :) " << endl;
cout << " please Enter username : ";
cin >> user;
cout << " please Enter password : ";
cin >> pass;
if (user == newuser && pass == newpass)
cout << " you logged in ; ";
else
cout << " wrong username or password, please try again ";
}
// main
int main ()
{
cout << " welcome " <<
endl;
registration sign;
sign.signup();
sign.signin();
}