Test Results Schedule Miscellanea Chap. 10 Break Hands on Q & A Conclusion References Files

Similar documents
Test Results Schedule Miscellanea Control Structs. Add l Oper s Break Hands on Q & A Conclusion References Files

Dr. Chuck Cartledge. 7 Nov. 2017

Propedéutico de Programación

Short Notes of CS201

BLM2031 Structured Programming. Zeyneb KURT

The University of Alabama in Huntsville Electrical and Computer Engineering CPE Example of Objective Test Questions for Test 4

Ch. 10: Name Control

CS201 - Introduction to Programming Glossary By

QUIZ. What are 3 differences between C and C++ const variables?

Submit your answers to these questions to the Curator under Quizzes as HW08 by the posted due date and time. No late submissions will be accepted.

MPATE-GE 2618: C Programming for Music Technology. Syllabus

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information

San José State University Department of Computer Science CS-144, Advanced C++ Programming, Section 1, Spring 2018

QUIZ. Source:

Tokens, Expressions and Control Structures

CMPE 152 Compiler Design

CNG 140 C Programming. Syllabus. Course Info Fall Semester. Catalog Description

PESIT-BSC Department of Science & Humanities

COP 3014: Fall Final Study Guide. December 5, You will have an opportunity to earn 15 extra credit points.

Deccan Education Society s FERGUSSON COLLEGE, PUNE (AUTONOMOUS) SYLLABUS UNDER AUTONOMY. FIRST YEAR B.Sc. COMPUTER SCIENCE SEMESTER I

Dr. Chuck Cartledge. 15 July 2015

San José State University Computer Science CS 122 Advanced Python Programming Spring 2018

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

Chapter 8: Intraprogram Communication. Lecture 8 1

San José State University Department of Computer Science CS-144, Advanced C++ Programming, Section 1, Fall 2017

Computer Science II Lecture 1 Introduction and Background

CMPE 152 Compiler Design

CSc 2310 Principles of Programming (Java) Jyoti Islam

Syllabus COSC-051-x - Computer Science I Fall Office Hours: Daily hours will be entered on Course calendar (or by appointment)

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

PIC 10A. Review for Midterm I

The New C Standard (Excerpted material)

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, Pilani Pilani Campus Instruction Division. SECOND SEMESTER Course Handout Part II

Name Section: M/W or T/TH. True or False (14 Points)

3D Graphics Programming Mira Costa High School - Class Syllabus,

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency.

EEE145 Computer Programming

Computer Programming

CS/SE 153 Concepts of Compiler Design

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

APPENDIX A : Example Standard <--Prev page Next page -->

CSE030 Fall 2012 Final Exam Friday, December 14, PM

Computer Programming

Computer Programming

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, PILANI PILANI CAMPUS Instruction Division

Practical C++ Programming

CS 241 Data Organization using C

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011

Procedural Programming & Fundamentals of Programming

CMPE 152 Compiler Design

Introduction to Computing Lecture 01: Introduction to C

CMSC 202 Midterm Exam 1 Fall 2015

Functions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation.


UNIVERSITY REGULATIONS

Dr. Chuck Cartledge. 18 Feb. 2015

Patterns: Working with Arrays

Since we have declared a type, we can define a variable to hold values of this type.

Basic memory model Using functions Writing functions. Basics Prototypes Parameters Return types Functions and memory Names and namespaces

You must include this cover sheet. Either type up the assignment using theory3.tex, or print out this PDF.

Dr. Chuck Cartledge. 24 Oct. 2017

Fundamentals of Programming. Lecture 12: C Structures, Unions, Bit Manipulations and Enumerations

Review of the C Programming Language for Principles of Operating Systems

Introduction to C. Sami Ilvonen Petri Nikunen. Oct 6 8, CSC IT Center for Science Ltd, Espoo. int **b1, **b2;

ECE573 Introduction to Compilers & Translators

Advanced Programming Concepts. CIS 15 : Spring 2007

HOUSTON COMMUNITY COLLEGE BUSINESS TECHNOLOGY NORTHEAST COLLEGE-NORTHLINE LOCATION COURSE SYLLABUS FALL 2011 COMPUTER APPLICATION I POFI 1301

Today's Topics. CISC 458 Winter J.R. Cordy

BEng (Hons) Electronic Engineering. Resit Examinations for / Semester 1

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011

CPSC 427: Object-Oriented Programming

CSE 333 Midterm Exam 7/29/13

EL6483: Brief Overview of C Programming Language

Computer Department. Question (1): State whether each of the following is true or false. Question (2): Select the correct answer from the following:

CIS 130 Exam #2 Review Suggestions

Hrs Hrs Hrs Hrs Hrs Marks Marks Marks Marks Marks

CS 502 Introduction to Operating Systems. Fall 98 Waltham Campus

Linked lists Tutorial 5b

About this exam review

KOM3191 Object Oriented Programming Dr Muharrem Mercimek OPERATOR OVERLOADING. KOM3191 Object-Oriented Programming

CSC 148 Lecture 3. Dynamic Typing, Scoping, and Namespaces. Recursion

Review of the C Programming Language

C Programming SYLLABUS COVERAGE SYLLABUS IN DETAILS

Pointers. Addresses in Memory. Exam 1 on July 18, :00-11:40am

CSC 4710 / CSC 6710 Database Systems. Rao Casturi

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE

CS 137 Part 5. Pointers, Arrays, Malloc, Variable Sized Arrays, Vectors. October 25th, 2017

Computer System and programming in C

About this Course. Blackboard Student Orientation Course. About the Portal. Logging In. About the Course Layout. Showing the Course Menu

EECE.2160: ECE Application Programming Spring 2019

CS 240 Fall 2015 Section 004. Alvin Chao, Professor

SULTAN QABOOS UNIVERSITY COURSE OUTLINE PROGRAM: BSc. in Computer Science. Laboratory (Practical) Field or Work Placement

: Principles of Imperative Computation. Summer Assignment 4. Due: Monday, June 11, 2012 in class

Programming. C++ Basics

This handbook contains directions on using tools and resources in WebAccess at CSM.

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #1 Examination 12:30 noon, Tuesday, February 14, 2012

Dr. Chuck Cartledge. 3 June 2015

THE UNIVERSITY OF TEXAS AT AUSTIN MIS373 e-discovery and Digital Forensics SPRING 2015 Unique#: (03883) VERSION: 1/23/2015

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Transcription:

CSC-201 - Computer Science I Lecture #9: Chapter 10 (con t.) Dr. Chuck Cartledge October 19, 2016 at 3:04pm 1/28

Table of contents I 1 Test Results 2 Schedule 3 Miscellanea 4 Chap. 10 5 Break 7 Q & A 8 Conclusion 9 References 10 Files 6 Hands on 2/28

Histograms Histogram of questions and misses 3/28

Histograms Histogram of letter grades Test scores are only part of your final grade. See syllabus. 4/28

Histograms Q & A time. The Answer to the Great Question... Of Life, the Universe and Everything... is... forty-two, said Deep Thought, with infinite majesty and calm. Douglas Adams, The Hitchhiker s Guide to the Galaxy 5/28

Schedule for the semester: Wk. Date Topic Wk. Date Topic 1 08/22 Chaps. 1 2 9 10/17 Chap. 10 2 08/29 Chaps. 3 4 10 10/24 Chaps. 10 11 3 09/05 Chap. 5 11 10/31 Chaps. 10 11 4 09/12 Test Chap. 6 12 11/07 Test Chap. 14 5 09/19 Chap. 7 1 13 11/14 Chap. 14 6 09/26 Chap. 8 14 11/28 Chap. 18 7 10/03 Chap. 9 15 12/05 Chap. 18 8 10/10 Test Chap. 10 16 12/12 Exam Notes: 1 Class canceled due to electrical fire in instructor s home 6/28

Programming assignment #004 File Based Address Book Objectives are fairly straightforward: Accept two new commands from the user Commands are: + to add a new contact - to remove all contacts that match a search string Update the data file with new, or removed contacts Submit your source code. This is a single person effort (not a team effort). Due by start of class 26 Oct. 2016. 7/28

Programming assignment #004 Q & A time. Q: Do you know what the death rate around here is? A: One per person. Now is the time to ask questions. 8/28

Corrections and additions since last lecture. Completed grading homework for chapters 7, 8, and 9 Graded exam #002 9/28

Test Results Schedule Miscellanea Chap. 10 Break Hands on Q&A Conclusion References Files enums A quick review 1 There are different simple data types 2 typedef is a name substation, not type creation 3 Each type has a different size (see files section) 4 A type s domain is controlled by its size 5 enums are a type, and have limited domain 10/28

enums Some basics about enums enums are: 1 A simple variable type 2 You define the domain of values associated with the type 3 The domain values must be globally unique (can be jiggered using namespace tricks) We ll have a hand s on exercise with enums. 4 You can create new variables of your enum type 5 You can use them as pass parameters, return values, loop controls, and in comparisons 11/28

enums Creating enums There are a number of different ways to create enum depending on your need. 1 enum TYPE { domain }; enum TimeZones {EASTERN, CENTRAL, MOUNTAIN, PACIFIC}; Creates a new type that can be used where scoping rules permit. 2 enum { domain }; enum {EASTERN, CENTRAL, MOUNTAIN, PACIFIC}; Creates values (nearly like const int) that be used where scoping rules permit. 12/28

enums An example of using typed enum Using the enum statement from before: enum TimeZones {EASTERN, CENTRAL, MOUNTAIN, PACIFIC}; We can create a loop like: 13/28

structs structs are structured data types A structured data type is a type in which each value is a collection of component items The entire collection has a single name Each component can be accessed individually Used to bundle together related data of various types for convenient access under the same identifier 14/28

structs An example Image from [2]. 15/28

structs We have created a new User Data Type (UDT) Now that we have created a UDT named AnimalType, we can declare variables of that type: AnimalType thisanimal; AnimalType anotheranimal; These are two totally independent variables, that are made up of other variables. 16/28

structs Important things to remember about structs 1 The struct declaration names a type and names the members of the struct 2 It does not allocate memory for any variables of that type! 3 You still need to declare your struct variables 4 Scope of a struct: If the struct type declaration precedes all functions, it will be visible throughout the rest of the file If it is placed within a function, only that function can use it 5 It is common to place struct type declarations in a (.h) header file and #include that file 6 It is possible for members of different struct types to have the same identifiers; 7 Also a non-struct variable may have the same identifier as a structure member 17/28

structs How to access struct members? Dot (period) is the member selection operator After the struct type declaration, the various members can be used in your program only when they are preceded by a struct variable name and a dot Image from [1]. 18/28

structs Same image. Image from [1]. 19/28

structs Examples of accessing struct members. thisanimal.age = 18; thisanimal.id = 2037581; cin >> thisanimal.weight; getline (cin, thisanimal.species); thisanimal.name = giant panda; thisanimal.genus[0] = toupper(thisanimal.genus[0]); thisanimal.age++; 20/28

structs There are member operations and aggregate operations A member operation in on a single member of a struct. An aggregate operation is an operation on a data structure as a whole. Including: Assignment to another struct variable of the same type Pass by value, or reference Returned from a function 21/28

structs structs can contain other strucks. structs that contain other structs are called: hierarchical structures. (They are also sometimes called nested structures.) All the rules about simple structs apply to hierarchical structs (member operations, aggregate operations, and dot operations) as well. 22/28

Break time. Take about 10 minutes. 23/28

Practice exercises Programs to load into CodeBlocks and get running: 1 variablesize.cpp find the size of an enum 2 enumio.cpp the program almost works 3 cars.cpp working with structs Others, if you have time. 24/28

Q & A time. Q: How many software engineers does it take to change a light bulb? A: None. We ll document it in the manual. 25/28

What have we covered? Returned and reviewed test #02 Discussed programming assignment #004 Continued chapter 10 Next time: continue Chapter 10, looking at unions and pointers, and start Chapter 11 26/28

References I [1] Richard Smith et al., Working draft, standard for programming language c++, ISO/IEC JTC1/SC22/WG21 document N 4296 (2015). [2] Sylvia Sorkin, Programming and problem solving with c++, Teacher Resource Jones and Barlett Learning, 2014. 27/28

Files of interest 1 Fibonacci as a simple lookup 6 Fibonacci as a state machine fibonanci-function-lookup.cpp 2 Fibonacci as a WHILE loop fibonanci-for-loop.cpp 3 Fibonacci as a function call fibonanci-function.cpp 4 Fibonacci as a recursive function fibonanci-recursive-function.cpp fibonanci-statemachine.cpp 7 variablesize.cpp size of different variable types 8 enumio.cpp working with enum types 9 cars.cpp reading and working 5 Fibonacci as a process queue fibonanci-processqueue.cpp with structs 10 cars.dat cars.cpp data file 28/28