#include <iostream> #include "admin.h" #include <process.h> //for exit() #include "stdafx.h" #include <string> //header file for string using namespace std; Admin::admin() { strcpy(username, "jam"); strcpy(password, "jam1"); }; bool Admin::check_username(string username1) //check user name { if (username1==username) return true; else return false; } //////////////////////////////////////////////////////////////////////////////////////// bool Admin::check_password(string password1) //check password { if(password==password1) return true; else return false; } void main() { string username1; string password1; bool check; Admin administration(); while(exit()==false); //this will check the user want to continue or exit exit(1); do{ check=true; system("cls"); /////clear the output ////// fflush(stdin); /////clear the input, so that can key in new input///// //system("color 0f"); //// change color to black background and white font cout<<"\n\n\t\t\t WELCOME TO LOGIN Menu\n"; cout<<"\n\t\t Enter the user name : "; cin>>username1; cout<<"\t\t Enter the password : "; cin>>password1; //admin --only has one admin if(administration.check_username(username1)) if(administration.check_password(password1)) admin_menu(); ////human resource //for( int i =0;i<=hrp_no;i++) // if(hrp_record[i].check_user_name(user_name)) // if(hrp_record[i].check_password(temp_pass)) // hr_personnel_menu(); ////staff //for( i =0;i<=staff_no;i++) // {if(staff_record[i].check_user_name(user_name)) // if(staff_record[i].check_password(temp_pass)) // {staff_record[i].showdata();cout<<"\n\t\t";system("pause");check=false;} } } bool exit() //exit menu { char a; system("cls"); /////clear the output ////// fflush(stdin); /////clear the input, so that can key in new input///// std :: cout<<"\n\t\tDo you want to exit? Y/N\n\t\t" std :: endl; std ::cin>>a; while(!(a=='Y' || a=='y' |a=='n' || a=='N' || a=='yes' || a=='Yes'|| a=='No'|| a=='no')) { cout<<"\n\t\tInvalid input. Please re-type!\n\t\t";system("pause"); system("cls"); /////clear the output ////// fflush(stdin); /////clear the input, so that can key in new input///// //cout<<endl<<"\n\t\tAre you want to exit? Y/N\n\t\t"; //cin>>e; std :: cout<<"\n\t\tDo you want to exit? Y/N\n\t\t" std :: endl; std ::cin>>a; //cin>>e; } if(a=='Y' ||a=='y' ||a=='Yes' ||a=='yes') return true; else return false; } void admin_menu { std ::cout<<"succesfully" <<std :: endl; } |
#include <string> //header file for string using namespace std; class Admin //administrator class { private: char username[10]; char password[10]; public : Admin(); //default constructor bool check_username(string); bool check_password(string); }; |
int array[5]
|
|
int array2[5]
and I want to compare the enitre array like this:
|
|