CS16, 10W, H06 (Functions that print characters using for and if) Total points: ?
Available online at: http://www.cs.ucsb.edu/~pconrad/cs16/10W/homework/H06 (printable PDF)
Accepted: on paper, in LAB (Thursday afternoon Jan 21th)
Late Policy: No email submission allowed—and don't "slip it under my door". If you need to make it up, you must do so during office hours, or make an appointment to see me, and you must request this appointment within 48 hours of when the assignment was originally due.
Personal Day/Sick Day policy: Everyone is permitted one "personal day/sick day" when you get to make up a missed homework assignment for free during office hours or via appointment. After that, you may not make up the homework assignment—you can only earn back the points through extra credit opportunities.
(For more details, see the syllabus and the homework policy)
Name: (2 pts)___________________________ UMail address (3 pts) ______________@umail.ucsb.edu
Lab Section (5 pts) Circle one: 3pm 4pm 5pm unknown
(Note: For now, circle the lab section you are registered for on GOLD. If you need to request attendance at a different lab section because of an ACTUAL SCHEDULE CONFLICT, please email pconrad@cs.ucsb.edu with details)
This assignment is due IN LAB on Thursday.
It may ONLY be turned in during LAB on Thursday.
Do NOT turn it in early in lecture on Thursday.
This assignment is based on material covered in lecture on Tuesday 01/19
If you missed these lectures, as is traditional in college/university level coures, it is your responsibility to make up what you missed by getting notes from fellow classmates. It is not the instructors responsibility to review the lecture with you at a later time.
You may also find it helpful to read about for loops, functions, and printf in your textbook—see the table of contents and index to find appropriate chapters.
This code | produces this output |
---|---|
printf("1234567890\n"); printf("|"); printKSpacesNXs(3,5); printf("|\n"); |
1234567890 | xxxxx| |
printf("1234567890\n"); printf("|"); printKSpacesNXs(2,4); printf("|\n"); |
1234567890 | xxxx| |
Please turn over for questions to answer
Continued from other side
This code | produces this output |
---|---|
printf("1234567890\n"); printf("|"); alternatePrintNTimes(4,'x','o'); printf("|\n"); |
1234567890 |xoxo| |
printf("1234567890\n"); printf("|"); alternatePrintNTimes(5,'x','o'); printf("|\n"); |
1234567890 |xoxox| |
printf("1234567890\n"); printf("|"); alternatePrintNTimes(6,'+','-'); printf("|\n"); |
1234567890 |+-+-+-| |
printf("1234567890\n"); printf("|"); alternatePrintNTimes(7,'+','-'); printf("|\n"); |
1234567890 |+-+-+-+| |
printf("1234567890\n"); printf("|"); alternatePrintNTimes(7,'-','+'); printf("|\n"); |
1234567890 |-+-+-+-| |