1-12

1-12 - Problem Solving with Computers-II CS 24...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Problem Solving with Computers-II CS 24 January 12, 2010 Announcements • Note taker needed; Paid position; contact me for details. • Lecture notes available online – Username: ucsb-cs24 – Password: w10-cs24 • Lab section this week – Pointers – Classes • Survey – Score < 6 on data types, function, or control structures: speak to us – Diverse background (CS16, CS 10, CS 3) ♦ If you have not had 16 or 10 speak to me – Feedback ♦ Need for a bigger picture ♦ Learning about pointers ♦ Fast pace in programming courses ♦ Unfamiliarity with C++ syntax Testing Understanding of Pointers What is the output of the following code? int x = 3; int y = 4; int *pX = &x; int *pY = &y; if (pX == pY) cout << “pointers equal”; else cout<<“pointers not equal”; if (*pX == *pY) cout << “values equal”; else cout << “values not equal”; Testing Understanding of Pointers x = y; if (pX == pY) cout << “pointers equal”; else cout<<“pointers not equal”; if (*pX == *pY) cout << “values equal”; else cout << “values not equal”; x = 10; pX = pY; if (pX == pY) cout << “pointers equal”; else cout<<“pointers not equal”; if (*pX == *pY) cout << “values equal”; else cout << “values not equal”; Brief Outline of Storage Allocation • Stack – Data whose storage requirement is known at invocation/compile time – Pointers • Heap – Objects to which pointers point Lecture outline • ADT • Classes (OOP) • C++ language features • Unsorted List ADT 7 Data Abstraction Separation of a data type’s logical properties from its implementation. LOGICAL PROPERTIES IMPLEMENTATION What are the possible values? How can this be done in C++? What operations will be needed? How can data types be used? 8 APPLICATION 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 REPRESENTATION Example The separation of the representation of data from the applications that use the data at a logical level; a programming language feature that enforces information hiding. int y; y = 25; 9 Abstraction of C++ Data Type int Value range: INT_MIN . . INT_MAX Operations: + prefix- prefix + infix- infix * infix / infix % infix Relational Operators infix TYPE int IMPLEMENTATION Representation of int as 16 bits two’s complement + Implementation of Operations 10 Abstract Data Type (ADT) • A data type whose properties (domain and operations) are specified independently of any particular implementation. •...
View Full Document

This note was uploaded on 05/20/2010 for the course CS 24 taught by Professor Singh during the Winter '10 term at UCSB.

Page1 / 32

1-12 - Problem Solving with Computers-II CS 24...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online