encodeCipher - % 'phones' would become 'psheon'. % function...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% 9/21/2009 6:57 PM % Function Name: encodeCipher % Inputs: a char string % Outputs: a char string % % Function Description: % Write a function that takes in a string and returns the string % rearranged such that the first letter is put with the last letter, then % the second letter and the second to last letter, etc. For example,
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % 'phones' would become 'psheon'. % function code = encodeCipher(string) code = ; for i = 1:floor(length(string)/2) code = [code string(i) string(end-(i-1))]; end if(mod(length(string), 2) == 1) code = [code string(ceil(end/2))]; end...
View Full Document

This note was uploaded on 10/22/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Tech.

Ask a homework question - tutors are online