CSC161 2010F, Class 22: Discussion of Exam 1 Overview: * General Exam Issues. * This Course's Approach. * Specific Problems. Admin: * I have not yet finished grading exam 1. I'm trying, though. * No additional reading for tomorrow. * EC for participating in coming out week events * How extra credit works * I announce extra credit opportunities * You attend some/many of them * At the end of the semester, I distribute a checklist * You check the ones you attended IN WHICH YOU DID NOT SERVE A ROLE (E.g., DB gets no credit for soccer, MM gets no credit for singing) * I cap each primary category at three units * Academic * Support your classmates * I multiply by 0.5 * I add to your 100-scale numeric score * I compute your letter grade General Issues * GNU Coding standards should not be hard to follow. * Sam needs to give you more feedback. I think woot has a taser on sale to help with that. * A number of you seemed to start late * More questions would have been nice * More testing would have been nice * Cut and paste programming is bad + C doesn't always make it easy to factor out commanlities + You need to learn some more C to get around these issues * Strive for general solutions * Check for errors ETAOIN SHRDLU * Lots of nested ifs or switch statements (not general) * Better solution: Store the letters in an array * Issue: How do we deal with uppercase/lowercase * Two arrays, one of lowercase, one of uppercase * if ((ch == letters[i]) || (toupper(ch) == letters[i])) Triangles * Lots of clever attempts * Lots of missed attempts * Not a lot of error checking * Note: Identifying the longest side (and the other two) helps a lot. RPN: * Switch is your friend * getchar () is your friend * Sam wrote it badly. Yes, even the great Sam, with more years of programmingexperience than you've been alive, makes mistakes. Interpreting Bits * Need to break the problem up into pieces * Parse command line and turn into an array of 0's and 1's. (strings are much harder to deal with) * Convert array using unsigned interpretation * Convert array using signed magnitude (builds upon unsigned) * Convert array using excess 128 (builds upon unsigned) * Convert array using one's complement (builds upon unsigned) * Need to flip bits * Convert array using two's complement * Need to flip bits * Need to "add 1" printf ("So, isaac, do you mean that I should only communicate in C?"); while (studentNumber < maxStudents) callOn (studentNumber);