Week 15 - Friday.  What did we talk about last time?  Review up to Exam 2.

Slides:



Advertisements
Similar presentations
A C++ Crash Course Part II UW Association for Computing Machinery Questions & Feedback.
Advertisements

Week 5 Part I Kyle Dewey. Overview Exam will be back Thursday New office hour More on functions File I/O Project #2.
CS 241 Section Week #5 2/23/12. 2 Topics This Section MP4 overview Function Pointers Pthreads File I/O.
Chapter 11 C File Processing Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
CSSE221: Software Dev. Honors Day 27 Announcements Announcements Projects turned in? Projects turned in? The 2 required Angel surveys are due by 9 pm tonight.
Guide To UNIX Using Linux Third Edition
Gursharan Singh Tatla Transport Layer 16-May
Console and File I/O - Basics Rudra Dutta CSC Spring 2007, Section 001.
An Introduction to C Programming (assuming that you already know Java; this is not an introduction to C++)
1 Homework Introduction to HW7 –Complexity similar to HW6 –Don’t wait until last minute to start on it File Access will be needed in HW8.
Week 13 - Monday.  What did we talk about last time?  Low level file I/O practice  File systems.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
 2007 Pearson Education, Inc. All rights reserved C File Processing.
22. FILE INPUT/OUTPUT. File Pointers and Streams Declarations of functions that perform file I/O appear in. Each function requires a file pointer as a.
Week 14 - Monday.  What did we talk about last time?  Introduction to C++  Input and output  Functions  Overloadable  Default parameters  Pass.
File Handling In C By - AJAY SHARMA. We will learn about- FFile/Stream TText vs Binary Files FFILE Structure DDisk I/O function OOperations.
 2007 Pearson Education, Inc. All rights reserved C File Processing.
1 Lecture09: File I/O 5/6/2013 Slides modified from Yin Lou, Cornell CS2022: Introduction to C.
File IO and command line input CSE 2451 Rong Shi.
CE Operating Systems Lecture 13 Linux/Unix interprocess communication.
Week 12 - Wednesday.  What did we talk about last time?  File I/O  Binary trees  Lab 11.
1 Lecture09: File I/O 11/19/2012 Slides modified from Yin Lou, Cornell CS2022: Introduction to C.
Socket Programming Lab 1 1CS Computer Networks.
Chapter 11: Data Files and File Processing Files and streams Creating a sequential access file Reading data from a sequential access file Using fgetc()
Basic I/O in C Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens Stream Model of I/O header file: A stream provides a connection.
Chapter 11 File Processing. Objectives In this chapter, you will learn: –To be able to create, read, write and update files. –To become familiar with.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 11 – File Processing Outline 11.1Introduction.
Chapter 7 Files By C. Shing ITEC Dept Radford University.
File Systems cs550 Operating Systems David Monismith.
CS 261 – Recitation 7 Spring 2015 Oregon State University School of Electrical Engineering and Computer Science.
Gramming An Introduction to C Programming (assuming that you already know Java; this is not an introduction to C++)
Files A collection of related data treated as a unit. Two types Text
CS 241 Section Week #5 9/22/11. 2 Topics This Section File I/O Advanced C.
 2007 Pearson Education, Inc. All rights reserved. 1 C File Processing.
FILES IN C. File Operations  Creation of a new file  Opening an existing file  Reading from a file  Writing to a file  Moving to a specific location.
Files. FILE * u In C, we use a FILE * data type to access files. u FILE * is defined in /usr/include/stdio.h u An example: #include int main() { FILE.
Connecting to Files In order to read or write to a file, we need to make a connection to it. There are several functions for doing this. fopen() – makes.
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
Week 15 - Friday.  What did we talk about last time?  Review up to Exam 2.
 2007 Pearson Education, Inc. All rights reserved C File Processing.
Week 12 - Friday.  What did we talk about last time?  Exam 2 post mortem.
Real Numbers Device driver process within the operating system that interacts with I/O controller logical record 1 logical record 2 logical record 3.
Sockets Intro to Network Programming. Before the internet... Early computers were entirely isolated No Internet No network No model No external communications.
An Introduction to C Programming (assuming that you already know Java; this is not an introduction to C++)
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
Week 13 - Friday.  What did we talk about last time?  Server communications on a socket  Function pointers.
By C. Shing ITEC Dept Radford University
11 C File Processing.
Lecture 11 File input/output
TMF1414 Introduction to Programming
Week 12 - Wednesday CS222.
File Access (7.5) CSE 2031 Fall July 2018.
An Introduction to C Programming
File I/O.
Week 14 - Monday CS222.
Week 13 - Friday CS222.
CS111 Computer Programming
File Input/Output.
Files I/O, Streams, I/O Redirection, Reading with fscanf
Strings, Line-by-line I/O, Functions, Call-by-Reference, Call-by-Value
Chapter 11 – File Processing
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
Text and Binary File Processing
File Input and Output.
Accessing Files in C Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
Fundamental of Programming (C)
Module 12 Input and Output
Week 12 - Wednesday CS222.
Exceptions and networking
Presentation transcript:

Week 15 - Friday

 What did we talk about last time?  Review up to Exam 2

 A binary search tree is binary tree with three properties: 1. The left subtree of the root only contains nodes with keys less than the root’s key 2. The right subtree of the root only contains nodes with keys greater than the root’s key 3. Both the left and the right subtrees are also binary search trees

typedef struct _Tree { int data; struct _Tree* left; struct _Tree* right; } Tree; typedef struct _Tree { int data; struct _Tree* left; struct _Tree* right; } Tree;

 Think of a file as a stream of bytes  It is possible to read from the stream  It is possible to write to the stream  It is even possible to do both  Central to the idea of a stream is also a file stream pointer, which keeps track of where in the stream you are  We have been redirecting stdin from and stdout to files, but we can access them directly as well

 To open a file, call the fopen() function  It returns a pointer to a FILE object  Its first argument is the path to the file as a null- terminated string  Its second argument is another string that says how it is being opened (for reading, writing, etc.) FILE* file = fopen("data.txt", "r");

 The following are legal arguments for the second string ArgumentMeaning "r" Open for reading. The file must exist. "w" Open for writing. If the file exists, all its contents will be erased. "a" Open for appending. Write all data to the end of the file, preserving anything that is already there. "r+" Open a file for reading and writing, but it must exist. "w+" Open a file for reading and writing, but if it exists, its contents will be erased. "a+" Open a file for reading and writing, but all writing is done to the end of the file.

 Once you've got a file open, write to it using fprintf() the same way you write to the screen with printf()  The first argument is the file pointer  The second is the format string  The third and subsequent arguments are the values FILE* file = fopen("output.dat", "w"); fprintf(file, "Yo! I got %d on it!\n", 5); FILE* file = fopen("output.dat", "w"); fprintf(file, "Yo! I got %d on it!\n", 5);

 Once you've got a file open, write to it using fscanf() the same way you write to the screen with scanf()  The first argument is the file pointer  The second is the format string  The third and subsequent arguments are pointers to the values you want to read into FILE* file = fopen("input.dat", "r"); int value = 0; fscanf(file, "%d", &value); FILE* file = fopen("input.dat", "r"); int value = 0; fscanf(file, "%d", &value);

 When you're doing using a file, close the file pointer using the fclose() function  Files will automatically be closed when your program ends  It's a good idea to close them as soon as you don't need them anymore  It takes up system resources  You can only have a limited number of files open at once FILE* file = fopen("input.dat", "r"); int value = 0; fscanf(file, "%d", &value); fclose(file); FILE* file = fopen("input.dat", "r"); int value = 0; fscanf(file, "%d", &value); fclose(file);

 If you need to do character by character output, you can use fputc()  The first argument is the file pointer  The second is the character to output  putc() is an equivalent function FILE* file = fopen("output.dat", "w"); for( int i = 0; i < 100; i++ ) fputc(file, '$'); FILE* file = fopen("output.dat", "w"); for( int i = 0; i < 100; i++ ) fputc(file, '$');

 If you need to do character by character input, you can use fgetc()  The argument is the file pointer  It returns the character value or EOF if there's nothing left in the file  getc() is an equivalent function FILE* file = fopen("input.dat", "r"); int count = 0; while( fgetc(file) != EOF ) count++; printf("There are %d characters in the file\n", count); FILE* file = fopen("input.dat", "r"); int count = 0; while( fgetc(file) != EOF ) count++; printf("There are %d characters in the file\n", count);

 C programs that run on the command line have the following file pointers open by default  stdin  stdout  stderr  You can use them where you would use other file pointers

 Technically, all files are binary files  They all carry data stored in binary  But some of those binary files are called text files because they are filled with human readable text  When most people talk about binary files, they mean files with data that is only computer readable

 Wouldn't it be easier to use all human readable files?  Binary files can be more efficient  In binary, all int values are the same size, usually 4 bytes  You can also load a chunk of memory (like a WAV header) into memory with one function call Integer Bytes in text representation

 To specify that a file should be opened in binary mode, append a b to the mode string  On some systems, the b has no effect  On others, it changes how some characters are interpreted FILE* file = fopen("output.dat", "wb"); FILE* file = fopen("input.dat", "rb");

 The fread() function allows you to read binary data from a file and drop it directly into memory  It takes  A pointer to the memory you want to fill  The size of each element  The number of elements  The file pointer double data[100]; FILE* file = fopen("input.dat", "rb"); fread(data, sizeof(double), 100, file); fclose(file); double data[100]; FILE* file = fopen("input.dat", "rb"); fread(data, sizeof(double), 100, file); fclose(file);

 The fwrite() function allows for binary writing  It can drop an arbitrarily large chunk of data into memory at once  It takes  A pointer to the memory you want to write  The size of each element  The number of elements  The file pointer short values[50]; FILE* file = NULL; //fill values with data file = fopen("output.dat", "wb"); fwrite(values, sizeof(short), 50, file); fclose(file); short values[50]; FILE* file = NULL; //fill values with data file = fopen("output.dat", "wb"); fwrite(values, sizeof(short), 50, file); fclose(file);

 The fseek() function takes  The file pointer  The offset to move the stream pointer (positive or negative)  The location the offset is relative to  Legal locations are  SEEK_SET From the beginning of the file  SEEK_CUR From the current location  SEEK_END From the end of the file (not always supported) FILE* file = fopen("input.dat", "rb"); int offset; fread(&offset,sizeof(int),1,file); //get offset fseek(file, offset, SEEK_SET); FILE* file = fopen("input.dat", "rb"); int offset; fread(&offset,sizeof(int),1,file); //get offset fseek(file, offset, SEEK_SET);

 You just learned how to read and write files  Why are we going to do it again?  There is a set of Unix/Linux system commands that do the same thing  Most of the higher level calls ( fopen(), fprintf(), fgetc(), and even trusty printf() ) are built on top of these low level I/O commands  These give you direct access to the file system (including pipes)  They are often more efficient  All low level I/O is binary

 To use low level I/O functions, include headers as follows: #include  You won't need all of these for every program, but you might as well throw them all in

 High level file I/O uses a FILE* variable for referring to a file  Low level I/O uses an int value called a file descriptor  These are small, nonnegative integers  Each process has its own set of file descriptors  Even the standard I/O streams have descriptors StreamDescriptorDefined Constant stdin0STDIN_FILENO stdout1STDOUT_FILENO stderr2STDERR_FILENO

 To open a file for reading or writing, use the open() function  There used to be a creat() function that was used to create new files, but it's now obsolete  The open() function takes the file name, an int for mode, and an (optional) int for permissions  It returns a file descriptor int fd = open("input.dat", O_RDONLY);

 The main modes are  O_RDONLY Open the file for reading only  O_WRONLY Open the file for writing only  O_RDWR Open the file for both  There are many other optional flags that can be combined with the main modes  A few are  O_CREAT Create file if it doesn’t already exist  O_DIRECTORY Fail if pathname is not a directory  O_TRUNC Truncate existing file to zero length  O_APPEND Writes are always to the end of the file  These flags can be combined with the main modes (and each other) using bitwise OR int fd = open("output.dat", O_WRONLY | O_CREAT | O_APPEND );

 Opening the file is actually the hardest part  Reading is straightforward with the read() function  Its arguments are  The file descriptor  A pointer to the memory to read into  The number of bytes to read  Its return value is the number of bytes successfully read int fd = open("input.dat", O_RDONLY); int buffer[100]; read( fd, buffer, sizeof(int)*100 ); //fill with something int fd = open("input.dat", O_RDONLY); int buffer[100]; read( fd, buffer, sizeof(int)*100 ); //fill with something

 Writing to a file is almost the same as reading  Arguments to the write() function are  The file descriptor  A pointer to the memory to write to  The number of bytes to write  Its return value is the number of bytes successfully written int fd = open("output.dat", O_WRONLY); int buffer[100]; int i = 0; for( i = 0; i < 100; i++ ) buffer[i] = i + 1; write( fd, buffer, sizeof(int)*100 ); int fd = open("output.dat", O_WRONLY); int buffer[100]; int i = 0; for( i = 0; i < 100; i++ ) buffer[i] = i + 1; write( fd, buffer, sizeof(int)*100 );

 To close a file descriptor, call the close() function  Like always, it's a good idea to close files when you're done with them int fd = open("output.dat", O_WRONLY); //write some stuff close( fd ); int fd = open("output.dat", O_WRONLY); //write some stuff close( fd );

 It's possible to seek with low level I/O using the lseek() function  Its arguments are  The file descriptor  The offset  Location to seek from: SEEK_SET, SEEK_CUR, or SEEK_END int fd = open("input.dat", O_RDONLY); lseek( fd, 100, SEEK_SET ); int fd = open("input.dat", O_RDONLY); lseek( fd, 100, SEEK_SET );

 Virtually all file systems have each partition laid out something like this  The boot block is the first block and has information needed to boot the OS  The superblock has information about the size of the i-node table and logical blocks  The i-node table has entries for every file in the system  Data blocks are the actual data in the files and take up almost all the space Boot blockSuperblocki-node TableData blocks

 Every file has an i-node in the i-node table  Each i-node has information about the file like type (directory or not), owner, group, permissions, and size  More importantly, each i-node has pointers to the data blocks of the file on disk  In ext2, i-nodes have 15 pointers  The first 12 point to blocks of data  The next points to a block of pointers to blocks of data  The next points to a block of pointers to pointers to blocks of data  The last points to a block of pointers to pointers to pointers to blocks of data

 Not every layer is always used  Sometimes user errors are referred to as Layer 8 problems LayerNameMnemonicActivityExample 7ApplicationAwayUser-level dataHTTP 6PresentationPretzelsData appearance, some encryptionSSL 5SessionSaltySessions, sequencing, recovery IPC and part of TCP 4TransportThrowFlow control, end-to-end error detectionTCP 3NetworkNotRouting, blocking into packetsIP 2Data LinkDare Data delivery, packets into frames, transmission error recovery Ethernet 1PhysicalProgrammersPhysical communication, bit transmission Electrons in copper

 The goal of the OSI model is to make lower layers transparent to upper ones Application Presentation Session Transport Network Data Link Physical Application Presentation Session Transport Network Data Link Physical MACIPUDPPayload IPUDPPayload UDPPayload

 The OSI model is sort of a sham  It was invented after the Internet was already in use  You don't need all layers  Some people think this categorization is not useful  Most network communication uses TCP/IP  We can view TCP/IP as four layers: LayerActionResponsibilitiesProtocol ApplicationPrepare messagesUser interactionHTTP, FTP, etc. Transport Convert messages to packets Sequencing, reliability, error correction TCP or UDP Internet Convert packets to datagrams Flow control, routingIP Physical Transmit datagrams as bits Data communication

 A TCP/IP connection between two hosts (computers) is defined by four things  Source IP  Source port  Destination IP  Destination port  One machine can be connected to many other machines, but the port numbers keep it straight

 Sockets are the most basic way to send data over a network in C  A socket is one end of a two-way communication link between two programs  Just like you can plug a phone into a socket in your wall (if you are living in 1980)  Both programs have to have a socket  And those sockets have to be connected to each other  Sockets can be used to communicate within a computer, but we'll focus on Internet sockets

 If you want to create a socket, you can call the socket() function  The function takes a communication domain  Will always be AF_INET for IPv4 Internet communication  It takes a type  SOCK_STREAM usually means TCP  SOCK_DGRAM usually means UDP  It takes a protocol  Which will always be 0 for us  It returns a file descriptor (an int ) int sockFD = -1; sockFD = socket(AF_INET, SOCK_STREAM, 0); int sockFD = -1; sockFD = socket(AF_INET, SOCK_STREAM, 0);

 Using sockets is usually associated with a client- server model  A server is a process that sits around waiting for a connection  When it gets one, it can do sends and receives  A client is a process that connects to a waiting server  Then it can do sends and receives  Clients and servers are processes, not computers  You can have many client and server processes on a single machine

socket() bind() listen() accept() recv() send() close() socket() connect() recv() send() close() Repeat until done ServerClient

 Once you've created your socket, set up your port and address, and called connect(), you can send data  Assuming there were no errors  Sending is very similar to writing to a file  The send() function takes  The socket file descriptor  A pointer to the data you want to send  The number of bytes you want to send  Flags, which can be 0 for us  It returns the number of bytes sent char* message = "Flip mode is the squad!"; send(socketFD, message, strlen(message)+1, 0); char* message = "Flip mode is the squad!"; send(socketFD, message, strlen(message)+1, 0);

 Or, once you're connected, you can also receive data  Receiving is very similar to reading from a file  The recv() function takes  The socket file descriptor  A pointer to the data you want to receive  The size of your buffer  Flags, which can be 0 for us  It returns the number of bytes received, or 0 if the connection is closed, or -1 if there was an error char message[100]; recv(socketFD, message, 100, 0); char message[100]; recv(socketFD, message, 100, 0);

 Sending and receiving are the same on servers, but setting up the socket is more complex  Steps: 1. Create a socket in the same way as a client 2. Bind the socket to a port 3. Set up the socket to listen for incoming connections 4. Accept a connection

 C can have pointers to functions  You can call a function if you have a pointer to it  You can store these function pointers in arrays and structs  They can be passed as parameters and returned as values  Java doesn't have function pointers  Instead, you pass around objects that have methods you want  C# has delegates, which are similar to function pointers

 The syntax is a bit ugly  Pretend like it's a prototype for a function  Except take the name, put a * in front, and surround that with parentheses #include int main() { double (*root) (double); //pointer named root root = &sqrt; //note there are no parentheses printf( "Root 3 is %lf", root(3) ); printf( "Root 3 is %lf", (*root)(3) ); //also legal return 0; } #include int main() { double (*root) (double); //pointer named root root = &sqrt; //note there are no parentheses printf( "Root 3 is %lf", root(3) ); printf( "Root 3 is %lf", (*root)(3) ); //also legal return 0; }

 C++ is based on C and easier to use  You can declare variables anywhere ▪ Not the case in the C89 standard (where all variables had to be declared right after a block starts), but our gcc is following the C99 standard  It has function overloading  Most people think the I/O is cleaner  The big addition is OOP through classes  It's an approximate superset of C that includes most C structures

 It's not too different from C  We need different headers for C++ I/O #include using namespace std; int main() { cout << "Hello, world!" << endl; return 0; } #include using namespace std; int main() { cout << "Hello, world!" << endl; return 0; }

 Output uses the cout object (of type ostream )  Instead of using formatting strings, cout uses the idea of a stream, where objects are placed into the stream separated by the extraction operator <<  The endl object adds a newline to the stream  Of course, "\n" works too int x = 50; cout << "There are " << x << " ways to leave your lover." << endl; int x = 50; cout << "There are " << x << " ways to leave your lover." << endl;

 Input uses the cin object (of type istream )  cin also uses the idea of a stream, where items are read from the stream and separated by the insertion operator >>  It reads items using whitespace as the separator, just like scanf() int x = 0; int y = 0; int z = 0; cout << "Enter the x, y, and z values: "; cin >> x >> y >> z; int x = 0; int y = 0; int z = 0; cout << "Enter the x, y, and z values: "; cin >> x >> y >> z;

 Like Java, C++ has a class for holding strings, which makes life much easier  It's called string (with a lower case 's' )  You must include to use it  Unlike String in Java, string is mutable  You can use array-style indexing to get and set individual characters string a = "Can I kick it?"; string b = "Yes, you can!"; string c = a + " " + b; c[0] = 'D'; c[1] = 'i'; c[2] = 'd'; cout << c << end; //prints Did I kick it? Yes, you can! string a = "Can I kick it?"; string b = "Yes, you can!"; string c = a + " " + b; c[0] = 'D'; c[1] = 'i'; c[2] = 'd'; cout << c << end; //prints Did I kick it? Yes, you can!

 Java uses packages to keep different classes with the same name straight  C++ uses namespaces  The standard library includes I/O ( ), the string class ( ), STL containers (,,, and others)  If you use these in your program, put the following after your includes  The alternative is to specify the namespace by putting the it followed by two colons before the class name using namespace std; std::string name = "Ghostface Killah";

 Regular C++ functions are very similar to to functions in C  A big difference is that prototypes are no longer optional if you want to call the function before it's defined  Unlike C, function overloading allowed: int max(int a, int b) { return a > b ? a : b; } int max(int a, int b, int c) { return max( a, max( b, c)); } int max(int a, int b) { return a > b ? a : b; } int max(int a, int b, int c) { return max( a, max( b, c)); }

 In C, all functions are pass by value  If you want to change an argument, you have to pass a pointer to the value  In C++, you can specify that a parameter is pass by reference  Changes to it are seen on the outside  You do this by putting an ampersand ( & ) before the variable name in the header void swap(int &a, int &b) { int temp = a; a = b; b = temp; } void swap(int &a, int &b) { int temp = a; a = b; b = temp; }

 C++ also allows you to specify default values for function parameters  If you call a function and leave off those parameters, the default values will be used  Default parameters are only allowed for the rightmost grouping of parameters void build(int width = 2, int height = 4) { cout << "We built this house with " << width << " by " << height << "s."; } void build(int width = 2, int height = 4) { cout << "We built this house with " << width << " by " << height << "s."; } build(); //We built this house with 2 by 4s. build(3); //We built this house with 3 by 4s. build(6, 8); //We built this house with 6 by 8s. build(); //We built this house with 2 by 4s. build(3); //We built this house with 3 by 4s. build(6, 8); //We built this house with 6 by 8s.

 When you want to dynamically allocate memory in C++, you use new (instead of malloc() )  No cast needed  It "feels" a lot like Java int* value = new int(); //make an int int* array = new int[100]; //array of ints Wombat* wombat = new Wombat(); //make a Wombat Wombat* zoo = new Wombat[100]; //makes 100 Wombats with the default constructor int* value = new int(); //make an int int* array = new int[100]; //array of ints Wombat* wombat = new Wombat(); //make a Wombat Wombat* zoo = new Wombat[100]; //makes 100 Wombats with the default constructor

 When you want to free dynamically allocated memory in C++, use delete (instead of free() )  If an array was allocated, you have to use delete[] int* value = new int(); //make an int delete value; Wombat* wombat = new Wombat(); delete wombat; Wombat* zoo = new Wombat[100]; delete[] zoo; //array delete needed int* value = new int(); //make an int delete value; Wombat* wombat = new Wombat(); delete wombat; Wombat* zoo = new Wombat[100]; delete[] zoo; //array delete needed

 Let's see how objects work in C++ by looking at classically important elements of OOP  Encapsulation  Dynamic dispatch  Polymorphism  Inheritance  Self-reference

 In C++, you can overload operators, meaning that you can define what + means when used with classes you design  Thus, the following could be legal: Hippopotamus hippo; Sandwich club; Vampire dracula = club + hippo; Hippopotamus hippo; Sandwich club; Vampire dracula = club + hippo;

 Allow classes and functions to be written with a generic type or value parameter, then instantiated later  Each necessary instantiation is generated at compile time  Appears to function like generics in Java, but works very differently under the covers  Most of the time you will use templates, not create them

 The Standard Template Library (STL) is a collection of templated classes designed to solve common programming problems  The most common use of them is containers, similar to the Java Collections Framework (JCF) classes like LinkedList and HashMap  A few important STL containers are:  list  map ▪ multimap  set ▪ multiset  stack  queue ▪ deque  priority_queue  vector

 There is no next time!

 Finish Project 6  Due tonight before midnight!  Study for Final Exam  7:30am - 10:30am, Friday, 5/08/2015 (CS222 A)  11:00am - 2:00pm, Thursday, 5/07/2015 (CS222 B)