l11 - : CSci 1113 C/C+ for Scientists and Engineers Section...

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

View Full Document Right Arrow Icon
: CSci 1113 C/C++ for Scientists and Engineers Section 010 - evening class Exam Review, C and C++ strings Prof. Eric Van Wyk and Ted Kaminski Spring 2010 c ± Van Wyk and Kaminski CSci 1113: C/C++ for Scientists and Engineers, evening class Spring 2010 Page 1 / 35
Background image of page 1

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

View Full DocumentRight Arrow Icon
: Agenda I review for midterm exam I strings as char arrays I The C++ string class I begin dynamic memory allocation and pointers. c ± Van Wyk and Kaminski CSci 1113: C/C++ for Scientists and Engineers, evening class Spring 2010 Page 2 / 35
Background image of page 2
Lab midterm exam review : Logistics I Two hours: 90 minutes for exam and 30 minutes for grading. I Open book, notes, lab files, course web pages. I A web browser can be connected to the course website. I Be sure to get all the code you’ve written with your lab partner. I You can ask a TA about a ”syntax” problem. e.g., what does this error message mean? I If you finish early, your exam can be graded but in silence. c ± Van Wyk and Kaminski CSci 1113: C/C++ for Scientists and Engineers, evening class Spring 2010 Page 3 / 35
Background image of page 3

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

View Full DocumentRight Arrow Icon
Lab midterm exam review : Coverage I Material covered: chapters 1-5 and 12 of the text. I Functions, Arrays, File I/O and streams. I Be able to write complete working programs that use these features. I Significant points allowed for partial work. I See the online review document and sample exam. c ± Van Wyk and Kaminski CSci 1113: C/C++ for Scientists and Engineers, evening class Spring 2010 Page 4 / 35
Background image of page 4
C-style strings : C and C++ strings I There are two implementations of strings in C++. 1. The old version inherited from C. 2. The new class-based C++ version. c ± Van Wyk and Kaminski CSci 1113: C/C++ for Scientists and Engineers, evening class Spring 2010 Page 5 / 35
Background image of page 5

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

View Full DocumentRight Arrow Icon
C-style strings : C-style strings I Implemented as an array of characters. I The length is not explicitly specified. The end of the string is indicated by the character \ 0 . I char s[10]; This holds a string of at most 9 characters. One extra is needed for the “sentinel” \ 0 . I How is “Hi Mom!” represented this way? c ± Van Wyk and Kaminski CSci 1113: C/C++ for Scientists and Engineers, evening class Spring 2010 Page 6 / 35
Background image of page 6
C-style strings : ASCII I ASCII - American Standard Code for Information Interchange I A mapping of characters to integer values. I The character ’H’ is represented by integer 72, a space is 32. See the Wikipedia table. I See ASCII.cpp . I Let’s add a length function. c ± Van Wyk and Kaminski CSci 1113: C/C++ for Scientists and Engineers, evening class Spring 2010 Page 7 / 35
Background image of page 7

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

View Full DocumentRight Arrow Icon
C-style strings : Exercise 11.1 What is a function declaration for a function that concatenates two C-strings to create a third? c ± Van Wyk and Kaminski CSci 1113: C/C++ for Scientists and Engineers, evening class Spring 2010 Page 7 / 35
Background image of page 8
: Exercise 11.2 Sketch the definition of this function. c
Background image of page 9

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

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

This note was uploaded on 10/28/2010 for the course CSCI 1113 taught by Professor Staff during the Spring '08 term at Minnesota.

Page1 / 39

l11 - : CSci 1113 C/C+ for Scientists and Engineers Section...

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

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