Lab 8: C++ Strings

Quiz:

The quiz will be available during the first 5 minutes of lab:

    • Your lab TA will tell you the password you will need to get into the quiz for your section.

    • You may use either one of the lab machines or your own laptop.

      • For the lab computers your account name and password are the same as your UIC NetID and password.

    • Please Click on Your Lab Time: 9am, 10am, 11am, 12pm, 1pm, 2pm, 3pm, 4pm, 5pm



In this lab you will write your 3 of your own C++ string functions. For all these functions you will only have to worry about a single word per string and the strings have only upper and lowercase letters. For all three functions you may assume that the strings being compared or manipulated are of the same length.

  • void reverseAllButFirstAndLast()

    • You will take in a string and reverse the string in place, NOT including the first and last characters.
      Examples:

      • Hello -> Hlleo

      • remake -> rkamee

  • int countEqualChars()

    • You will take in two strings and count and return the number of characters that are the same, not including spaces. A character counts as being the same if it is the same character, in the same location in both strings.
      Examples:

      • today and rodeo
        Equal Chars = 2

      • okay and good
        Equal Chars = 0

  • int mirrorPairComparisons()

    • You will take in two strings, reverse one of them, and then check and return how many characters are the same.
      Example:

      • ratslive EVILstar
        Num equal: 4

328268.713192.qx3zqy7