Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Using a table that contains vowels.
- Enter a word and print all the vowels in the word
- Print how many times each vowel occurs remember y is only a vowel if no other letters in the word are vowels.
- All input is to be in lower case.
- to set up the table you may use .word 'a','e','i','o','u','y'
- note: the characters are in single quotes this will set up a table that looks like this in memory
- 0x00000061 0x00000065 0x00000069 0x0000006f 0x00000075 0x00000079
- you can make your table bytes or whatever else you'd like
- name your file firstInitianLastNameP2.asm or it will not be graded (my file would be named ELichtenthalP2.asm)
- be sure to comment and upload your file
- no word will be more that 15 characters
- your counters should be an array of 6 elements in memory
- example
- counters: .word 0,0,0,0,0,0
- you should have at least 1 function. register usage must be adhered to with all functions. parameters a registers, returned vales a registers, caller and callee registers saved and restored.
- Extra credit
- must do all to receiver extra credit. input can be upper or lower case or numbers or special characters, and can be multiple words. If multiple words, output the vowel count for each word separately
- sample runs
- Enter a word
- happy
- the vowels and their count are
- a - 1
- -- program is finished running --
- Enter a word
- why
- the vowels and their count are
- y - 1
- -- program is finished running --
- Enter a word
- receiver
- the vowels and their count are
- e - 3
- i - 1
- -- program is finished running --
- Enter a word
- monopoly
- the vowels and their count are
- o - 3
- -- program is finished running --
- Enter a word
- onomatopoeia
- the vowels and their count are
- a - 2
- e - 1
- i - 1
- o - 4
- -- program is finished running --
- ------------------------------------------MY ALGORITHM------------------------------------------------
- 1) initialize word array made out of .words containing aeiouy, TEST
- 2) initialize counter array consisting of 6 integers stored in .word, COUNTER
- 3) prompt user for word and store it in an array size 15, WORD
- 4) initalize two counters, t0 (for our TEST) and t1 (for our WORD)
- a)test t1 against t0
- b)if there is no match, increment t0 TEST
- c) if there are no matches when you hit the end of t0 TEST, increment t1 WORD and reset t0 TEST
- d) if there is a match, increment the COUNTER via the number in TEST (ex: so, if we encounter an "i", our TEST t0 should be at 2, so our COUNTER will get incremented there as well)
- e) increment t1 WORD, reset t0 TEST and go again
- f) upon reaching the end of t1 WORD, terminate the loop (make this one into the function?)
- 5) test to check if there are other vowels than "y"
- a) if no, output the number of y's
- b) if yes, go to 6
- 6) check each COUNTER for 0
- a) if non-zero, output letter and the counter
- b) if zero, skip and go to the next one
- 7) terminate program
Advertisement
Add Comment
Please, Sign In to add comment