main.cpp
//fn to input key and plaintext from user, and convert it to the prescribed format

fn to input key and plaintext from user, and convert it to the prescribed format
fn to input key and plaintext from user and convert it to the prescribed format
void playfair ::inputplay()
{
    cout << "Enter key of maximum 200 characters: ";
    fflush(stdin);
    gets(inp_key);
    cout << "\nEnter message of maximum 200 characters: ";
    fflush(stdin);
    gets(plaintext_playfair);
    int i;
    for (i = 0; i < strlen(inp_key); i++)
        inp_key[i] = tolower(inp_key[i]);
    char temp[200];
    int k = 0;
    for (i = 0; i < strlen(plaintext_playfair); i++)
    {
        if (plaintext_playfair[i] < 'a' || plaintext_playfair[i] > 'z')
            continue;
        else
        {
            temp[k++] = plaintext_playfair[i];
            if (plaintext_playfair[i] == plaintext_playfair[i + 1])
                temp[k++] = 'x';
        }
    }
    temp[k] = '\0';
    strcpy(plaintext_playfair, temp);
    int l = strlen(plaintext_playfair);
    if (l % 2 == 1)
    {
        plaintext_playfair[l++] = 'x';
        plaintext_playfair[l] = '\0';
    }
    generate_key();
    generate_grid();
}
void playfair :: inputplay ( ) { cout << " " ; fflush ( stdin ) ; gets ( inp_key ) ; cout << " \n " ; fflush ( stdin ) ; gets ( plaintext_playfair ) ; int i ; for ( i = 0 ; i < strlen ( inp_key ) ; i ++ ) inp_key [ i ] = tolower ( inp_key [ i ] ) ; char temp [ 200 ] ; int k = 0 ; for ( i = 0 ; i < strlen ( plaintext_playfair ) ; i ++ ) { if ( plaintext_playfair [ i ] < ' ' || plaintext_playfair [ i ] > ' ' ) continue ; else { temp [ k ++ ] = plaintext_playfair [ i ] ; if ( plaintext_playfair [ i ] == plaintext_playfair [ i + 1 ] ) temp [ k ++ ] = ' ' ; } } temp [ k ] = ' \0 ' ; strcpy ( plaintext_playfair , temp ) ; int l = strlen ( plaintext_playfair ) ; if ( l % 2 == 1 ) { plaintext_playfair [ l ++ ] = ' ' ; plaintext_playfair [ l ] = ' \0 ' ; } generate_key ( ) ; generate_grid ( ) ; }
fn to input key and plaintext from user, and convert it to the prescribed format
fn to input key and plaintext from user and convert it to the prescribed format
// Convert all letters to lowercase
 //Remove all spaces and numbers from plaintext_playfair, insert 'x' between repeated letters
 // Make number of letters in plaintext_playfair even
