Home > Back-end >  Want god to help me see me do - while loop problem in where
Want god to help me see me do - while loop problem in where

Time:09-21

Here I'd like to make a loop body, this is the login interface, only if the success of landing or choose 3 can exit the loop, so register can also display the login screen, but now that you enter 2 registered after finish it looks like the end of cycle,,,
#include
#include
#include
#include
#include
using namespace std;

Void Login_Menu ()
{
Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * family financial assistant * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" T \ \ t \ t welcome the use of family financial assistant "& lt; Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" \ t | & lt; 1> Login | "& lt; Cout<& lt;" \ t | & lt; 2> Registration | "& lt; Cout<& lt;" \ t | & lt; 3> Quit | "& lt; Cout<& lt;" \ \ \ t \ \ t t t t ";
//getTime ();
Cout
Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; CoutCout<& lt;" \ t * * * * * * * * * * * * * * * * * * operational number: please enter your... * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; }//login interface

Void the MainMenu ()
{
Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * family financial assistant * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" T \ \ t \ t please choose function "& lt; Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" \ t | & lt; 1> Members of the household income information input | "& lt; Cout<& lt;" \ t | & lt; 2> Members of the household spending information input | "& lt; Cout<& lt;" \ t | & lt; 3> Family members information query | "& lt; Cout<& lt;" \ t | & lt; 4> Family members information delete | "& lt; Cout<& lt;" \ t | & lt; 5> Family member information modification | "& lt; Cout<& lt;" \ t | & lt; 6 & gt; Back at the next higher level | "& lt; Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" \ \ \ t \ \ t t t t ";
//getTime ();
Cout
Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" \ n \ n ";
Cout<& lt;" \ t * * * * * * * * * * * * * * * * * * operational number: please enter your... * * * * * * * * * * * * * * * * * * * * "& lt; }//login and enter the home page



The class User
{
Public:
The User () {}
Void Move (string n, string a)
{
The username=n;
Password=a;
}
String GetUsername () {return the username; }//query name
String GetPassword () {return password; }
Friend class ArrayOfUsers;
Friend void Login (ArrayOfUsers users, int d);
Private:
String username;
String password;


};



The class ArrayOfUsers
{
Public:
ArrayOfUsers (int size) : the size (size) {
The users=new User [size];
}
/* ~ ArrayOfUsers ()
{
The delete [] the users;
} */
The User & amp; {
element (int index)Assert (index>=0 & amp; & IndexReturn the users [index];
}
Void the Add (string n, string a);
Friend class User;
Friend void Login (ArrayOfUsers users, int d);
Private:
int a;
Int size;
User * users;
Static int record_index;
};

Int ArrayOfUsers: : record_index=0;




Void ArrayOfUsers: : Add (string n, string a)
{
The users [record_index]. Username=n;
The users [record_index]. Password=a;//this member function is quite so registered information before, in turn, assigned to the 10 members, create
Record_index + +;//and record_index is used to record a few members assigned a value, whether in login time after contrast consistent user name and password will be used ()
}


Void the Login (ArrayOfUsers users, int d)
{
Login_Menu ();

String username;
String password;
Int login_select;
Bool is_successfully_login=false;
Bool is_account_found=false;
Bool is_password_correct=false;

Int I, h;
String f;
Do {//I want to have made a loop body, here is the login screen, only if the success of landing or choose 3 can exit the loop, so register can also display the login screen, you can choose what to do next
cin> Login_select;
The switch (login_select)
{
Case 1:
for(i=1; i{
F=users. Element (I). The GetUsername ();
If (f! H=0="");
The else h=1;
}
If (h==0)
{
Cout & lt; <"There is currently no account in the system, please create the account, after" & lt; Cout & lt; Cout & lt; <"User name:";
Setbuf (stdin, NULL);//refresh the input buffer
Getline (cin, username);
Cout & lt; <"Password:";
Setbuf (stdin, NULL);//refresh the input buffer
Getline (cin, password);
CoutUsers. The Add (username, password);
Cout & lt; <"Account creation success!"

Cout & lt; Char a, [9]. nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related