1 / 143
文档名称:

【工具辅导类】C++ By Example(四).pdf

格式:pdf   页数:143
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

【工具辅导类】C++ By Example(四).pdf

上传人:中国课件站 2011/7/19 文件大小:0 KB

下载得到文件列表

【工具辅导类】C++ By Example(四).pdf

文档介绍

文档介绍:Part IV
Structures and File
Input/Output
C++ By
28EXAMPLE
Structures
Using structures, you have the ability to group data and work with
the grouped data as a whole. Business data processing uses the
concept of structures in almost every program. Being able to ma-
nipulate several variables as a single group makes your programs
easier to manage.
This chapter introduces the following concepts:
♦ Structure definitions
♦ Initializing structures
♦ The dot operator (.)
♦ Structure assignment
♦ Nested structures
This chapter is one of the last in the book to present new
concepts. The remainder of the book builds on the structure con-
cepts you learn in this chapter.
583
Chapter 28 ♦ Structures
Introduction to Structures
Structures can have A structure is a collection of one or more variable types. As you
members of different know, each element in an array must be the same data type, and you
data types.
must refer to the entire array by its name. Each element (called a
member) in a structure can be a different data type.
Suppose you wanted to keep track of your CD music collection.
You might want to track the following pieces of information about
each CD:
Title
Artist
Number of songs
Cost
Date purchased
There would be five members in this CD structure.
TIP: If you have programmed in puter languages, or
if you have ever used a database program, C++ structures are
analogous to file records, and members are analogous to fields
in those records.
After deciding on the members, you must decide what data
type each member is. The title and artist are character arrays, the
number of songs is an integer, the cost is floating-point, and the date
is another character array. This information is represented like this:
Member Name Data Type
Title Character array of 25 characters
Artist Character array of 20 characters
Number of songs Integer
Cost Floating-point
Date purchased Character array of eig

最近更新

2024年甘肃财贸职业学院单招职业适应性测试题.. 41页

2024年盐城幼儿师范高等专科学校单招职业技能.. 40页

2024年石家庄工商职业学院单招职业倾向性测试.. 39页

2024年石家庄经济职业学院单招职业技能测试题.. 39页

小学生红色故事宣讲《杨靖宇》 5页

2024年福建省三明市单招职业适应性考试题库及.. 40页

2024年福建艺术职业学院单招职业倾向性考试模.. 41页

2024年绍兴文理学院单招职业适应性考试模拟测.. 39页

2024年苏州工业园区职业技术学院单招职业技能.. 41页

2024年衡水健康科技职业学院单招职业适应性测.. 40页

2024年西南交通大学希望学院单招职业倾向性考.. 39页

2024年西安城市建设职业学院单招综合素质考试.. 40页

2024年贵州城市职业学院单招职业倾向性测试模.. 38页

2024年贵州建设职业技术学院单招职业技能测试.. 40页

2024年贵州电子商务职业技术学院单招综合素质.. 40页

2024年贵州省铜仁地区单招职业适应性测试模拟.. 40页

2024年贵阳职业技术学院单招职业适应性测试模.. 39页

2024年赤峰应用技术职业学院单招职业倾向性测.. 41页

2024年辽宁工程职业学院单招职业适应性测试模.. 41页

2024年辽宁现代服务职业技术学院单招综合素质.. 40页

2024年辽宁省本溪市单招职业适应性测试模拟测.. 41页

2024年辽宁经济职业技术学院单招综合素质考试.. 39页

2024年辽宁铁道职业技术学院单招职业适应性考.. 39页

2024年连云港师范高等专科学校单招职业技能测.. 41页

2024年邯郸应用技术职业学院单招综合素质考试.. 38页

2024年郑州体育职业学院单招职业倾向性考试题.. 40页

2024年郑州汽车工程职业学院单招职业倾向性考.. 42页

2024年郑州科技学院单招职业倾向性测试题库推.. 39页

2025年重庆市《保安员证》考试题库含答案 39页

预防滑倒、绊倒及跌落专题培训课件 45页