Starting from:
$30

$24

Homework 4 SOlution

Files to submit: anagram.c

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.
 
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

Please enter the first word: MaRy
Please enter the second word: arMY MaRy is an anagram of arMY




Please enter the first word: dog
Please enter the second word: god dog is an anagram of god




Please enter the first word: bob
Please enter the second word: bobs bob is NOT an anagram of bobs




Please enter the first word: aap
Please enter the second word: pap aap is NOT an anagram of pap







Files to submit: mat_add.c

Time it took Matthew to Complete: 10 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.
Write a program called mat_add.c that asks the user for 2 matrices A, and B, and displays their sum, C.




All numbers entered will be integers
All matrices will be valid
The maximum dimension of each matrix is 100
Each row of the matrix will be entered 1 line at a time
5. The formula for calculating C[i][j] is C [i ][ j ]= A[i ][ j ]+ B [i ][ j ]

For more on how to compute the sum of two matrices see here: http://www.purplemath.com/modules/mtrxadd.htm
Examples:

Please enter the number of rows: 2
Please enter the number of columns: 2 Enter Matrix A

1 2

3 4

Enter Matrix B 100 200 200 400

A+B=

101 202

203 404

Please enter the number of rows: 2
Please enter the number of columns: 3 Enter Matrix A

10 20 -30

1 2 7

Enter Matrix B 1230 -345




A+B= 11220 -2612




Files to submit: pascal.c

Time it took Matthew to Complete: 20 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.
For this problem you will be printing out Pascal's Triangle. If you have never heard of Pascal's Triangle recommend checking out its Wikipedia Page.




Assumptions and Requirements




The maximum level that you will have to display is 28



You should NOT use the combinations method for finding the value of an element because it will lead you to getting some wrong answers as the values generated through this method can become larger than the largest possible integer.
You do not have to make your output appear as a triangle



Hints




The animation on the Wikipedia page is very helpful in figuring out how you should get started.












Examples




Please enter how many levels of Pascal's Triangle you would like to see: 2 1
1 1

Please enter how many levels of Pascal's Triangle you would like to see: 4 1
1 1

1 2 1

1331

More products