function [message] = encrypt(filename, K)
%ENCRYPT Encrypts a text file using a given key K.
%  filename = the name (a string) of the file containing the text to
%             encrypt.
%  message = encrypted text created using substitution cipher key K.
%  This function also writes the encrypted text to the file 'enc.txt'.

% Readfile handles reading for you and stores the char array in m
m = readfile(filename);
% m now contains an array of characters specified in file <filename>.

% YOUR CODE GOES BELOW



% YOUR CODE GOES ABOVE

% Write encrypted text to a file
writefile('enc.txt', message)

