Homework 4 Time it took Matthew to Complete: 15 mins
• All programs must compile without warnings when using the -Wall and -Werror options
• Submit only the files requested
◦ Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc
• Your program must match the output exactly to receive credit.
◦ Make sure that all prompts and output match mine exactly.
◦ Easiest way to do this is to copy and paste them
• All input will be valid unless stated otherwise
• Print all real numbers to two decimal places unless otherwise stated
• The examples provided in the prompts do not represent all possible input you can receive.
• All inputs in the examples in the prompt are underlined
◦ You don’t have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
• If you have questions please post them on Piazza
Restrictions
• No global variables are allowed
• Your main function may only declare variables, call other functions, and assign
variables values.
Files to submit: anagram.c
For this problem you will be checking to see if two words are anagrams of each other. Two words are anagrams if the letters of one word can be rearranged to form the other word. For example Mary and army are anagrams because the letters in Mary can be rearranged to form army.
Assumptions
• User input will only contain alphabetical characters
• No word will be longer than 20 characters
Requirements
• Your check for an anagram should be case insensitive
◦ For example ARMY and mary should be considered to be anagrams
Hints
• Don’t forget that you can add and subtract characters
◦ For example ‘B’ – ‘A’ is 1 and 2 + ‘A’ is ‘C’
Examples
1.Please enter the first word: MaRy Please enter the second word: arMY MaRy is an anagram of arMY
2.Please enter the first word: dog Please enter the second word: god dog is an anagram of god
3.Please enter the first word: bob Please enter the second word: bobs bob is NOT an anagram of bobs
4.Please enter the first word: aap Please enter the second word: pap aap is NOT an anagram of pap