CISC181 9am 2/21 ************************ Some policy items ************************* (1) Handing back graded homeworks To help us be sure you get credit for your work, PLEASE put the following on your papers: * first AND last name * section number * For date, use "date assignment is due" (not date when you complete it) e.g. if you did today's homework last night, put 2/21, not 2/20. (2) Homework policy for adding course late (during free drop/add) If you added course late, there will be a string of "leading zeros" for the homework assignments you missed. We will update those zeros with "prorated grades" of the next several homeworks. (That is, the next several homeworks will "count double".) So if you are in this situation, pay careful attention to the next several homeworks. You should still complete the missing homeworks for your own learning, but don't hand them in for a grade. If you want to know whether your answers are correct, see your instructor or TA during office hours. (3) Excused absences for minor illnesses: * If you have a cold/flu, etc. and you will not be able to come to class, send me email _before_ class if possible. If not possible, let me know as soon as possible by email, or in an emergency, by phone to 831-8622 (with a follow-up email ASAP). Go through a third party if necessary (e.g. tell your roommate to email me) but let me know BEFORE class or SOON AFTER class. * If this is an infrequent occurrence, and you notify me in a timely manner by email, I will consider such absences as excused, and they will not count towards the "three strikes" attendance policy. * You need an email from me confirming this for the absence to be considered excused. * Same policy for lab: cc your TA if the absence pertains to lab. * Time is of the essence: you cannot let me know about an absence you had "several days ago" for a "minor" illness and expect to be excused. If you couldn't get to a phone or email for more than two days, that sounds like a more serious illness---the kind that should be taken to your Dean's office. * I may suspend this procedure at my discretion if I think it is being abused. (4) Homework and excused absences For excused absences, a zero will be recorded for your homework, but you can make up the zero in one of two ways: (a) If you got an email excusing your absence, print it out, attach it to the late homework, and turn it in as soon as possible. If you turn it in before that particular assignment is graded, I will count it as a regular submission, with no penalty. (b) If you turn the missing assignment in after that homework assignment is graded, then instead of grading it, I might "double count" the next homework assignment that is due, scaling the point value up or down as needed. (e.g. if missing assignment is a 20 point assignment, and your next homework you get a 9/10, I would record 18/20 for the missing assignment.) (5) Forgetting your homework... I don't want to create an incentive for student's to "fake an illness" when they forget their homework, so a similar amnesty policy applies to "occaisionally" forgotten homework: * If you turn in a blank sheet of paper indicating you were present in class, and then later submit the missing assignment BEFORE we have graded that assignment, we'll count it as a regular submission. * If you turn in a missing homework AFTER it is graded, it will be recorded as a zero and returned to you ungraded. * A _limited_ number of such zeros for forgotten homework (e.g. an isolated case now and then) may be made up by coming to Prof. Conrad's office hours or making an appointment, where I will apply the same procedure: i.e. scaling up the next submission and double counting it. * This may ONLY be done in person; not by email. * This courtesy is a privilege not a right; you earn it by: --- Having a pattern of almost always turning in your homework forgetting very seldom. Consecutive missed homeworks will always be counted as zeros. --- Having a good record of attendance in general --- Specifically, attending the lecture where the assignment was due and turning in a blank sheet to record your attendance on that day. * Student who neither attend the class where the assignment was due, nor contact the instructor to indicate the reason for an excused absense have no rights or privileges under this policy. * This privilege may be suspended if it is abused. **************************************************** Today's Notes **************************************************** (1) Convert sample program from 2/9 in "fictional language" into C++ integer w, x, y, z y = 0 w = 0 read x // value coming from user s/x/howMany/ while (y < x) // y < x is a boolean expression, true or false begin read z w = w + z y = y + 1 end print w // w is printed sum of all the z's s/w/sum/ end (1.5) Program dealing with arrays procedure main integer array x[10] integer i, j for (i = 1 to 10 step 1) read x[i] call test (x, 10) end procedure test (x, j) integer array x[j] integer i for (i = 1 to j step 1) if (x[i] < 0) print x[i] end (2) Review compling on strauss (went over on Fri 2/11, but make sure we covered everything in these notes...) ">" means the Unix prompt Show how to compile this with just > CC lab01b.cc > ./a.out Show same result with just g++ and then running a.out > g++ lab01b.cc > ./a.out Show that we can rename to lab01b.cpp and it doesn't matter. > mv lab01b.cc lab01b.cpp > g++ lab01b.cpp > ./a.out Show that we can name the executable something else with the -o switch: > g++ lab01b.cpp -o lab01b > ./lab01b You need the . if "." is not in your path > ./lab01b You don't need the . if "." is in your path > lab01b How do we know if . is in the path? > echo $PATH How do we change our path (under csh or tcsh) ? What is csh or tcsh? emacs ~/.cshrc emacs ~/.localenv Using the "which" command to know where the compiler is coming from. If lab01b.cc is present, the command > make lab01b automatically converts into > CC -o lab01b lab01b.cc If you use the filename lab01b.cpp instead, you can still do: > CC -o lab01b lab01b.cpp but you can't use "make" unless you customize the rules that the "make" program uses by creating a custom "makefile". Makefiles are described in Appendix G of your Andersen textbook. (3) Another program, demonstrating "while loop" and "if/else" http://udel.edu/~pconrad/cisc181/05S/lect/code/8am/02.21/min-max.cc Note that there is no prompt for input. Note that you can type all five numbers on the same line, or on 5 different lines, or mix and match. Note that if you type in 6 numbers, 6th one is ignored. What happens if you mix non-numerics in with the numerics?