1. Trang chủ
  2. » Giáo án - Bài giảng

Giáo trình C++ - Ngành CNTT - Part 08

92 857 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Slide 1

  • Chapter 8

  • Overview

  • 8.1

  • An Array Type for Strings

  • C-string Details

  • C-string Declaration

  • Initializing a C-string

  • C-string error

  • Don't Change '0'

  • Safer Processing of C-strings

  • Assignment With C-strings

  • Assignment of C-strings

  • A Problem With strcpy

  • A Solution for strcpy

  • == Alternative for C-strings

  • strcmp's logic

  • More C-string Functions

  • The strncat Function

  • Display 8.1 (1/2)

  • Display 8.1 (2/2)

  • C-strings as Arguments and Parameters

  • C-string Output

  • C-string Input

  • Reading an Entire Line

  • Using getline

  • getline wrap up

  • getline and Files

  • getline syntax

  • C-String to Numbers

  • C-strings to Integers

  • C-string to long

  • C-string to double

  • Library cstdlib

  • Numeric Input

  • Display 8.2 (1/2)

  • Display 8.2 (2/2)

  • Confirming Input

  • Display 8.3 (1/3)

  • Display 8.3 (2/3)

  • Display 8.3 (3/3)

  • Section 8.1 Conclusion

  • 8.2

  • The Standard string Class

  • Assignment of Strings

  • Using + With strings

  • string Constructors

  • Mixing strings and C-strings

  • Display 8.4

  • I/O With Class string

  • getline and Type string

  • getline Example

  • Character Input With strings

  • Display 8.5 (1/2)

  • Display 8.5 (2/2)

  • Another Version of getline

  • getline Returns a Reference

  • getline Declarations

  • Mixing cin >> and getline

  • ignore

  • String Processing

  • Display 8.6

  • Member Function length

  • Member Function at

  • Display 8.7

  • Comparison of strings

  • Program Example: Palindrome Testing

  • Palindrome Testing: remove_punct

  • Palindrome Testing: substr

  • Palindrome Testing: The Program

  • Display 8.8 (1/4)

  • Display 8.8 (2/4)

  • Display 8.8 (3/4)

  • Display 8.8 (4/4)

  • string Objects to C-strings

  • Converting strings to C-strings

  • Section 8.2 Conclusion

  • 8.3

  • Vectors

  • Accessing vector Elements

  • Initializing vector Elements

  • The size Of A vector

  • The Type unsigned int

  • Alternate vector Initialization

  • Vector Initialization With Classes

  • The vector Library

  • Display 8.9

  • vector Issues

  • vector Efficiency

  • Controlling vector Capacity

  • Section 8.3 Conclusion

  • Chapter 8 -- End

Nội dung

[...]... Education, Inc Publishing as Pearson Addison-Wesley Slide 8- 19 Display 8.1 (1/2) Copyright © 2007 Pearson Education, Inc Publishing as Pearson Addison-Wesley Back Next Slide 8- 20 Display 8.1 (2/2) Copyright © 2007 Pearson Education, Inc Publishing as Pearson Addison-Wesley Back Next Slide 8- 21 C-strings as Arguments and Parameters   C-string variables are arrays C-string arguments and parameters are... function changes the value of a C-string parameter, it is best to include a parameter for the declared size of the C-string  If a function does not change the value of a C-string parameter, the null character can detect the end of the string and no size argument is needed Copyright © 2007 Pearson Education, Inc Publishing as Pearson Addison-Wesley Slide 8- 22 C-string Output  C-strings can be output with... Addison-Wesley Slide 8- 15 == Alternative for C-strings  The = = operator does not work as expected with C-strings  The predefined function strcmp is used to compareC-string variables  Example: #include … if (strcmp(c_string1, c_string2)) cout . s[9] H i M o m ! ? ? C-string Details Slide 8- 7 Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C-string Declaration  To declare a C-string variable, use the. work with C-strings Slide 8- 13 Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Assignment of C-strings  A common method to assign a value to a C-string variable. needed by '' Slide 8- 8 Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Initializing a C-string  To initialize a C-string during declaration: char

Ngày đăng: 14/07/2014, 11:00

TỪ KHÓA LIÊN QUAN

w