Lecture C++ programming: from problem analysis to program design - Chapter 9: Arrays and strings

After completing this unit, you should be able to: Learn about arrays, explore how to declare and manipulate data into arrays, understand the meaning of “array index out of bounds”, become familiar with the restrictions on array processing, discover how to pass an array as a parameter to a function, | C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 9: Arrays and Strings C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives In this chapter, you will: Learn about arrays Explore how to declare and manipulate data into arrays Understand the meaning of “array index out of bounds” Become familiar with the restrictions on array processing Discover how to pass an array as a parameter to a function C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives (continued) Learn about C-strings Examine the use of string functions to process C-strings Discover how to input data into—and output data from—a C-string Learn about parallel arrays Discover how to manipulate data in a two-dimensional array Learn about multidimensional arrays C++ Programming: From Problem Analysis to Program Design, Fourth Edition Data Types A data type is called simple if variables of that type can store only one value | C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 9: Arrays and Strings C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives In this chapter, you will: Learn about arrays Explore how to declare and manipulate data into arrays Understand the meaning of “array index out of bounds” Become familiar with the restrictions on array processing Discover how to pass an array as a parameter to a function C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives (continued) Learn about C-strings Examine the use of string functions to process C-strings Discover how to input data into—and output data from—a C-string Learn about parallel arrays Discover how to manipulate data in a two-dimensional array Learn about multidimensional arrays C++ Programming: From Problem Analysis to Program Design, Fourth Edition Data Types A data type is called simple if variables of that type can store only one value at a time A structured data type is one in which each data item is a collection of other data items C++ Programming: From Problem Analysis to Program Design, Fourth Edition Arrays Array: a collection of a fixed number of components wherein all of the components have the same data type In a one-dimensional array, the components are arranged in a list form Syntax for declaring a one-dimensional array: intExp evaluates to a positive integer C++ Programming: From Problem Analysis to Program Design, Fourth Edition Arrays (continued) Example: int num[5]; C++ Programming: From Problem Analysis to Program Design, Fourth Edition Accessing Array Components General syntax: where indexExp, called an index, is any expression whose value is a nonnegative integer Index value specifies the position of the component in the array [] is the array subscripting operator The array index always starts at 0 C++ Programming: From Problem Analysis to Program Design, Fourth Edition Accessing .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
187    24    1    24-11-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.