(a) Check to see how your
englishToPigLatin()function translates strings such as "grrrrr" that contain no vowels. If necessary, modify your function so that it leaves such strings unchanged.
englishToPigLatin()function is designed to handle words made up of only lowercase letters. Modify it so that it will also handle words that contain or consist entirely of uppercase letters.
englishToPigLatin()function fails to correctly translate words such as quiet (ietquay) and quack (ackquay), in which the first vowel is a 'u' following a 'q'. Redesign the algorithm used by
englishToPigLatin()and modify the function's code appropriately so that it will correctly translate words like quiet, quack, and squire but still translate "Qatar" as "atarQay."
Project #6.2: A character string is said to be a palindrome if it reads the same when the order of its characters is reversed. For example, the following are all palindromes:Write a function that, given a character string, returns true if that string is a palindrome, and returns false otherwise.madam smada bob adams able was I ere I saw elba
Project #6.3: A (very) simple encryption method is to reverse the order of the characters in a word, so that if the characters in the messageWrite a function that, given a character string, returns the reverse of that character string.OEMOR OEMOR EROFEREHW TRA UOHTare reversed word-by-word, then the decoded message reads:ROMEO ROMEO WHEREFORE ART THOU
Project #6.4: Internet mailers and news-readers often contain a "rot13" function that can be used to "encrypt" words by rotating their characters 13 positions (i.e., A becomes N, B becomes O, C becomes P, ... Z becomes M). This is convenient, because the same function can be used to both "encrypt" and "decrypt" a word:Write arot13("ROMEO") == "EBZRB"androt13("EBZRB") == "ROMEO"
rot13()function that, given a string, returns a string whose characters are those of the first string rotated 13 positions. It should use only the properties of the
stringclass that we have studied. Also, it should perform this rotation by applying appropriate arithmetic operations to the individual characters; it should not simply use a
casestatement with 52 cases, each of which replaces one letter with some other letter.
Back to the Lab Exercise
Back to This Lab's Home Page