Explore BrainMass

Explore BrainMass

    Pseudo Code: Output Position of First and Last Occurance - CAT

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Modify the pseudo code to (a) Output position of the first occurrence of the word "CAT" (b) Output the position of the last occurrence of the word "CAT"

    See attached file for full problem description.

    © BrainMass Inc. brainmass.com December 24, 2021, 6:21 pm ad1c9bdddf
    https://brainmass.com/computer-science/pseudocode/pseudo-code-output-position-occurance-cat-107771

    Attachments

    Solution Preview

    (a) When we first find 'CAT', we use break to jump out of the while loop.
    POS records the current position of 'CAT'.
    Count = 0
    POS = 0
    While POS < 100
    POS = POS + 1
    IF BOOK(POS) = 'CAT' ...

    Solution Summary

    The solution modifies the pseudo code to an output position of the first and last occurrence of the word "CAT."

    $2.49

    ADVERTISEMENT