Hi guys, i have been working on this database program for a while now and everything works perfect, except the login. The login basically takes the users password and username, and (its been a while im trying to remember) ok heres what it does:

(1) Gets information -- Appears to be working fine
(2) Adds (via the + operator) each character of the two arrays together (the password's first letter with the usernames first letter, and so on)
(3) Then it splits the new array in half (if the array has an odd number of elements it adds an x on the end) and XOR's one half with the other.
(4) Then character by character it compares the stored encrypted info (saved in a text file on the computer) with the newly encrypted information.
(5) If they match then the logged in bool is set to true and it then breaks the while loop and moves on to the rest of the program.

The problem is that it doesnt match every time, depending on what programs are running in the background the encrypted information changes. I suspect a variable is not being initialized or something along those lines, but i just checked and i couldnt find anything. I even went back and initialized all the char arrays. Still wont work. So heres the code for the login. If anyone can spot the problem i would appreciate it. Thanks!

Code:
...
//infinite loop
    while(1)
    {
        //title
        cout<<"**************************\n";
        cout<<"*     Black Squadron     *\n";
        cout<<"*        Database        *\n";
        cout<<"**************************\n\n";
        //login
        //init all vars
        char username[25];
        char password[25];
        char encinfo[25];
        char tempenc[25];
        char tempencI[25];
        char tempencII[25];
        //initialize all strings;
        username[0]='\0';
        password[0]='\0';
        encinfo[0]='\0';
        tempenc[0]='\0';
        tempencI[0]='\0';
        tempencII[0]='\0';
        int xleng=0;
        int i=0;
        //get information
        cout<<"Username: ";
        cin.getline(username, 25);
        cout<<"Password: ";
        cin.getline(password, 25);
        cout<<"\nPress enter to begin encryption...\n";
        cin.ignore();
        //encrypt
        for(i=0; i<25; i++)
        {
            tempenc[i]=username[i]+password[i];
        }
        xleng = strlen(tempenc);
        if((xleng%2)!=0)
        {
            tempenc[xleng+1]='x';
            xleng = strlen(tempenc);
        }
        for(int j=0; j<(xleng/2); j++)
        {
            tempencI[j]=tempenc[j];
        }
        i=0;
        for(int k=(xleng/2); k<xleng; k++)
        {
            tempenc[i]=tempenc[k];
            i++;
        }        
        for(int l=0; l<xleng; l++)
        {
            encinfo[l]=tempencI[l]^tempencII[l];
        }
        //convert non-standard characters to standard
        for(int m=0; m<(strlen(encinfo)); m++)
        {
            encinfo[m]=char(((int(encinfo[m]))%26)+65);
        }
        //END ENCRYPTION
        //check result with known result
        //get import variables
        char ch;
        char importloc[115]="C:/Documents and Settings/Douglas/My Documents/BlackSquadron/Department of Intelligence/Program Stuff/known.cmc";
        char importcode[16];
        importcode[0]='\0';
        i=0;
        //import
        ifstream fin(importloc);
        while(fin.get(ch))
        {
            importcode[i]=ch;
            i++;
        }
        fin.close(); 
        //evaluate
        //temp
        cout<<importcode<<"\t"<<encinfo;
        cin.ignore();
        //end temp.
        //eval. vars
        int encleng=0;
        int evalnum=0;
        cout<<flush;
        //temp must term. in final
        ofstream fout(importloc);
        fout<<encinfo;
        fout.close();
        //end temp.
        //evaluate both known and new info
        if(strlen(importcode)==strlen(encinfo))
        {
            encleng=(strlen(encinfo));
        }
        for(i=0; i<encleng; i++)
        {
            if(encinfo[i]==importcode[i])
            {
                evalnum++;
            }
        }            
        //temp
        cout<<evalnum<<"\t"<<encleng<<endl;
        cin.ignore();
        //end temp    
        if(evalnum==encleng)
        {
            cout<<"Successful Login!\n";
            cin.ignore();
            loggedin=0;
            break;
        }else{
            cout<<"Incorrect Login Information...\n";
            cin.ignore();
            break;
        }                        
    }
...
Thanks for any help you can provide, i appreciate it!