Assignment 1

Due by midnight on Monday, January 21.
Create a file named hw.c in your math211hw directory. This file should be a copy of the "Hello world" program and should print
Hello world.
on the screen and the prompt should appear on the next line.

If you want to make sure that I will be able to collect your file, type
Assign1
and hit enter. You should get a message back telling you that your file was found.



Assignment 2

Due by midnight on Tuesday January 29.
Write a program to evaluate Simpson's rule. Specifically, copy the tr.c file to a file named sr.c (Simpson's Rule dot c). Use the same function, interval and step size as we used in that program, but modify the calculation to evaluate Simpson's rule. Print the answer just as we did for the Trapezoid rule.

If you want to make sure that I will be able to collect your file, type
Assign2
and hit enter. You should get a message back telling you that your file was found.



Assignment 3

Due by midnight on Wednesday February 6.
Copy the program ll.c from our common space and change it so that if there are two or more lines of the same longest length, the last one found gets printed.

If you want to make sure that I will be able to collect your file, type
Assign3
and hit enter. You should get a message back telling you that your file was found.



Assignment 4

Due by midnight on Monday February 11.
Copy the program correct_ll.c from our common space. This is the original ll.c file with a bug fix. Rename the file to ll.c and change it so that the first instance of the next to the longest line gets printed. "Next longest" means any line whose length is strictly less than the length of the longest line and "first instance" means the first line of "next longest" length if there are several lines of that length.

You might want to test that your program behaves correctly under several situations. If all lines have the same length, the next longest is empty (not even a '\n'). Be sure that if you have two or more lines of longest length your program doesn't print out some occurrence of the longest line. Be sure it works if there are several lines of "next longest" length. Finally, be sure it handles cases where the longest line comes before the next longest and cases where it somes after.

If you want to make sure that I will be able to collect your file, type
Assign4
and hit enter. You should get a message back telling you that your file was found.

Assignment 5

Due by midnight on Wednesday February 27.
Alter the file "next_operation.c" to support signed numbers. As an example
3 2 -4 should leave 3, 2 and -4 on the stack, NOT 1 and 4 as it does now. Similarly,
3 2 +4 should leave 3, 2 and 4 on the stack, NOT 5 and 4 as it does now.

Be sure you handle strings like
+-6 correctly (first you do the + and then you push -6).

The issue here is that when you see a '+' or a '-' you don't yet know what to do and you won't until you read the next character. Since you are not allowed to alter any of the other files that make up the calculator program, you have to handle all the issues here.


Assignment 6

Due midnight Monday, April 15.

Modify the word_count.c program to accept command line arguments. Call the new file Word_count.c and alter main as follows. main should now accept command line arguments. If there are none, the program should print out the alphabetical-order tree. If there is a '-n' the program should print out the numerical-order tree; if there is a '-a' the program should print out the alphabetical-order tree. Multiple flags should be supported, so
a.out -ana
should print the tree 3 times, first in alphabetical order, then in numerical order and finally in alphabetical order again. The line
a.out -a -n -a
should produce the same result as should either
a.out -an -a
or
a.out -a -na
Your program should just ignore any command line arguments that it does not recognize. No error messages, etc. so
a.out Im not a moose
should be the same as no arguments and so should print the tree in alphabetical order. It used to read I'm not a moose, but I forgot that UNIX does weird things with certain characters on the command line, in particular apostrophes. Your program never got a chance to run.

Also
a.out -acv-na
should print the tree alphabetically, ignore the c, ignore the v, ignore the -, print the tree numerically and finally print the tree alphabetically.

You should also print one copy of the list alphabetically if you have command line arguments which begin with -'s but no a's or n's. So for example
a.out -xvxvx -yuytr -popiu
should print the list alphabetically once.

You can test your program by typing
a.out -anana -ahna < test_file
or whatever. The command line ends at the < so argc=3 in the example and the three C-strings are 'a.out', '-anana' and '-ahna'.

Assignment 6a

Due midnight Thursday, April 18.
Office hours Wednesday 2:30-3:30 instead of 3-4.
Office hours Thursday 8:15-9:15 am.
Always by appointment.

Fix your assignment 6 if it wasn't right. If it wasn't right your code should be included in the email I sent you. Look for LRT's for my comments.

Assignment 7

Due midnight Monday, April 22.

Change your Word_count.c file from Assignment 6 so that no matter what is typed on the command line you print at least one copy of the alphabetical list and one copy of the numerical list. In more detail, when you are done processing the command line arguments just as in Assignment 6, you need to be able to check if you have printed any copies of the list alphabetically. If you haven't, print one now. THEN check if you have printed any numerical copies. If not, print one now.

Assignment 8

Due midnight Friday, April 26.

Add a function to the quaternion class file "quat.cc". This function calculates the conjugate of a quaternion so the declaration should be

void conj(quat);

The invocation

Q1.conj(Q2);

should cause the conjugate of the quaternion Q2 to be put into the quaternion Q1.



Back.