Assignment05

advertisement
CSE 1311 – Homework #05
Due: Sunday, October 18, 2015 at 11:59pm
1- You must submit your homework through Blackboard (https://elearn.uta.edu/).
2- The answer file should be named using the following pattern:
X_Y_HW5.zip where X is your last name and Y is your first name.
3- Your answer should include:
a. Program1.c: A copy of your code from program1.
b. Program2.c: A copy of your code from program2.
4- Make sure your code can be compiled with no error prior submission. Codes which cannot be
compiled will get 0 points.
5- Your program must compile as a C89 program.
Assignment:
Program 1- Store the following secret message in a program:
S*adem*oek*bel[*fhe]hWcc_d]8
Your program should print the decrypted version of the message.
• Decrypt the message with the following process:
– If the ASCII value is greater than or equal to 87, add 10 to its value.
– If the ASCII value is less than 87, subtract 10 from its value.
•
You should hard-code the secret message in your program; don’t ask the user to type it in
or read it from a file.
Program 2- (50) Write a program to do the following:
1- Stores the following table of values in array A:
12
-8
2 10
23 31 -5 15
32 41 18 19
2- Stores the following table of values in array B:
14 27 -5
-9
21 54 82 16
59
-3 29 76
3- Add two matrix A and B, and print the result.
•The values within each column should be lined up and right-justified.
• While the table values will be stored in your program, nothing else about the specific values
should be hard-coded in your program beyond the fact that the table has three rows and four
columns of integers with at most two digits.
That is, if I were to replace the values with a different 3 × 4 array of integers, then the program
should still work.
• Sample Output:
26
44
91
19
85
38
-3
77
47
1
31
95
Download