ECE 160 – Comp Programming I Data Structures with C Prof. P. H. Viall Office: Research 217 Tel: (508) 999-8240 Web: http://portal.ece.umassd.edu/~pviall/ece160 Book: Computer Science: A Structured Programming Approach Using C B. A. Forouzan and Richard F. Gilberg Second Edition (or latest); Brooks/Cole, 2001.
44
Embed
ECE 160 – Comp Programming I Data Structures with C Prof. P. H. Viall Office: Research 217 Tel: (508) 999-8240 Web: pviall/ece160.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
ECE 160 – Comp Programming I Data Structures with C
Prof. P. H. Viall Office: Research 217
Tel: (508) 999-8240
Web: http://portal.ece.umassd.edu/~pviall/ece160
Book: Computer Science: A Structured Programming Approach Using CB. A. Forouzan and Richard F. GilbergSecond Edition (or latest); Brooks/Cole, 2001.
Tentative Grading• Exams (75%)
Best 3 of 4 exams (no makeups)Exams are 1 hour in class examsExams MAY be open book/note
• Homework/Programs/Labs (25%)
Note – scheme is tentative – grading may be adjusted ±2%
Working Together (programs)• is OK - TO A POINT• Working together appropriately means…
– Talking about a problem in general terms– One person helping another to fix a particular error
• Working together INAPPROPRIATLY means…– One person working, and one copying.– Person A does program 1 and person B copies, then
person B does program 2 and A copies.– One person using the mouse and one using the
keyboard to input a program, and then submit two copies of the same program (with just the persons name altered).
Working Together (programs)• If you do work together, please indicate
who you were working with• Penalty for INAPPROPRIATLY working
together– first offense: written warning; both on
homework and email to UMD account– second offense: grade of homework halved– third offense: grade of zero on homework– further offenses will result in lowering of
course grade, possibly to 'F'
UMD Policy on Academic DishonestyTaken from UMD Catalog 2003-2004, page 51
• All UMass Dartmouth students are expected to maintain high standards of academic integrity and scholarly practice. The University does not tolerate academic dishonesty of any variety, whether as a result of a failure to understand proper academic and scholarly procedure or as an act of intentional dishonesty.
• A student found guilty of academic dishonesty is subject to severe disciplinary action which may include expulsion from the University. Refer to the Student Handbook and Student Judicial Code for due process.
• A high standard of academic integrity promotes the pursuit of truth and learning and respect for the intellectual accomplishments of others. These are values that are fundamental to the mission of this University. Such values are undermined by academic dishonesty.
• Academic dishonesty is defined as attempting to obtain academic credit for work that is not one’s own. Examples include:
1. copying another student’s answers on an examination; 2. obtaining, or attempting to obtain, the answers to an examination in advance; 3. submitting a paper that was written by someone else; 4. submitting a paper that includes phrases, sentences and paragraphs that were copied verbatim, or almost
verbatim, from a work written by someone else, without making this clear without indicating that these words were someone else’s through the use of quotation marks or other appropriate citation conventions;
5. collaborating on a homework assignment when this has been expressly forbidden by the professor; 6. using unauthorized materials in completing assignments or examinations; 7. submitting the same paper for more than one class without the express permission of the instructors
involved. This list of examples should not be considered exhaustive.
UMD Policy on Academic Dishonesty• This definition of academic dishonesty applies to information submitted in other forms besides
paper. Submitting a project of a musical or artistic nature where all or part of the project is someone else’s work, without acknowledging this fact, constitutes academic dishonesty. Submitting computer files that do not represent one’s own work is also considered to be academic dishonesty; examples of computer-based academic dishonesty would include submitting a computer program or text file created by someone else as one’s own, or submitting the output of a computer program written by someone else, and claiming to have written the program that generated the output.
• For all forms of academic dishonesty, students who knowingly allow other students to use their work are themselves considered to be academically dishonest. Examples would include students who knowingly allow other students to copy their exam answers, and students who give papers that they have written to other students so that the other students can submit them for credit.
• A faculty member is appointed by the Faculty Senate to act as an Academic Ethical Matters Facilitator. This individual will offer advice to both students and faculty about the issues involved in penalizing academic dishonesty, and the process of appealing such penalties.
• Penalties assessed by faculty members for academic dishonesty generally consist of a reprimand, a requirement to resubmit the work in a more acceptable form, a lowering of a grade, failure in the course in which the alleged infraction took place, or a combination of these.
• Instead of (or in addition to) assessing such penalties, a faculty member may refer the matter to the UMass Dartmouth Student Judiciary. Decisions made by the Student Judiciary may be appealed to the University Appellate Board.
• A form acknowledging that each student has read, understands, and will abide by these standards will be signed by the student and placed into the student’s permanent file.
Working Together (exams)• Exams are definitely an individual endeavor.
• You may not work together during exams.
• You may not share any materials during an exam.
• In general the penalty for cheating on an exam or otherwise covertly attempting to raise your grade on an exam shall be an ‘F’ for the course.
Canceled Classes and Tests
• If class is cancelled the day an exam is scheduled, we will have the exam the next time the class meets
• If class is cancelled the session prior to the exam (the day you have to ask questions), then the next class meeting will be the “question time”, and the class meeting after that will be the exam
Course Objectives1. To learn how a computer stores data, and conversion between
various number bases2. To learn the fundamentals of using the c compiler and c
preprocessor3. To learn how to use a modern environment to create, compile,
execute and debug C programs4. To learn how to use procedures to modularize a program, and
how to pass parameters by value and by address5. To learn the syntax of the c language, including arrays,
structures, dynamic allocation, and file access6. To learn how to use and manipulate strings using the C language7. To learn to use system libraries within a program 8. To learn how to program, and how to design well written,
maintainable programs
Base ConversionsConvert 123|10 to Base 10 (gotta start someplace)
1 2 3 |10 = ? |10
| | |
| | `--- 3 x 100 = 3 x 1 = 3
| `----- 2 x 101 = 2 x 10 = 20
`------- 1 x 102 = 1 x 100 = 100
123
Therefore, 123|10 = 123|10
Base ConversionsConvert 123|8 to Base 10
1 2 3 |8 = ? |10
| | |
| | `--- 3 x 80 = 3 x 1 = 3
| `----- 2 x 81 = 2 x 8 = 16
`------- 1 x 82 = 1 x 64 = 64
83
Therefore, 123|8 = 83|10
Base ConversionsConvert 2BAD|16 to Base 10
2 B A D |16 = ? |10
| | | |
| | | `--- D x 160 = 13 x 1 = 13
| | `----- A x 161 = 10 x 16 = 160
| `------- B x 162 = 11 x 256 = 2816
`--------- 2 x 163 = 2 x 4096 = 8192
11181
Therefore, 2BAD|16 = 11181|10
Base ConversionsConvert 20DD|16 to Base 10
??
Base ConversionsConvert 20DD|16 to Base 10
2 0 D D |16 = ? |10
| | | |
| | | `--- D x 160 = 13 x 1 = 13
| | `----- D x 161 = 13 x 16 = 208
| `------- 0 x 162 = 0 x 256 = 0
`--------- 2 x 163 = 2 x 4096 = 8192
8413
Therefore, 20DD|16 = 8413|10
Base ConversionsConvert FACE|16 to Base 10
??
Base ConversionsConvert FACE|16 to Base 10
F A C E |16 = ? |10
| | | |
| | | `--- E x 160 = 14 x 1 = 14
| | `----- C x 161 = 12 x 16 = 192
| `------- A x 162 = 10 x 256 = 2560
`--------- F x 163 = 15 x 4096 = 61440
64206
Therefore, FACE|16 = 64206|10
Convert 123|10 to Base 8
8 )123
8 )15 R 3
8 )1 R 7
0 R 1
Therefore, 123|10 = 173|8
Base Conversions
Base you are converting to
Read Up!
Read Up!
Convert 64206|10 to Base 16
16 )64206
16 )4012 R 14 (E)
16 )250 R 12 (C)
16 )15 R 10 (A)
16 )0 R 15 (F)
Therefore, 64206|10 = FACE|16
Base Conversions
Base you are converting to
Step 1: 123|7=?|10
1 2 3
| | |
| | `-3x70= 3
| `--2x71=14
`-----1x72=49
66
123|7=66|10
Step 2: 66|10=?|9
9 )66
9 ) 7 R 3
0 R 7 66|10=73|9
123|7=73|9
Base Conversions123|7 = ?|9 (Can’t do directly)
Base Conversions• Converting between
bases which are powers of 2 (base 2, 4, 8, and 16)
• Each Digit in base 4, 8 or 16 represents 2, 3 or 4 bits