Preface
Structured Programming with C++ is intended as course material for the course Structured Programming with C/C++ at university level. It can also be used as self-learning material.
Each chapter contains theoretical parts and programming examples. At the end of each chapter there is a bunch of exercises for your practice. At the end of the book you will find solutions to the exercises.
The purpose of the book is primarily to teach how to ”think programming” and secondarily to teach C++ code. Therefore, I will emphasize how to focus on the problem solution and prepare the coding.
Contents
Content1. Introduction to Programming
1. What Does It Mean to Program
2. Coding
3. Compiling and linking
4. The First Steps with Visual C++
2. Variables
1. Introduction
2. Why Variables
3. Declaring Variables
4. Assignment
5. Initiating Variables
6. Constants
7. More about Assignment of Values
8. The main function
9. Input and Output
10. An Entry Program
11. Formatted Output
12. Invoice Program
13. Time Conversion Program
14. Type Conversion
15. The Random Number Generator
16. Game Program
17. Summary
18. Exercises
3. Selections and Loops
1. Introduction
2. Selection
3. if statement
4. Price Calculation Program
5. Comparison Operators
6. Even or Odd
7. else if
8. and (&&), or (||)
9. Conditional Input
10. The switch statement
11. Menu Program
12. Loops
13. The while Loop
14. The for Loop
15. Addition Program
16. Double Loop
17. Roll Dice
18. Two Dice Roll
19. Breaking Entry with Ctrl-Z
20. Pools
21. Equation
22. Interrupting a Loop - break
23. Summary
24. Exercises
4. Arrays
1. Introduction
2. Why Arrays
3. Declaring an Array
4. Initiating an Array
5. Copying an Array
6. Comparing Arrays
7. Average
8. Sales Statistics
9. Product File, Search
10. Two-Dimensional Array
11. Sorting
12. Searching a Sorted Array
13. Summary
14. Exercises
5. Strings
1. Introduction
2. Data Type char
3. Menu Program
4. Menu Program with Loop
5. Christmas Tree
6. int - char
7. Å, Ä, Ö
8. String Array, char[]
9. Length of a String
10. Upper/Lower Case
11. Initials
12. Comparing Two Strings
13. Copying Strings
14. Array with String Arrays
15. Sorting Strings
16. Substring
17. Concatenating Strings
18. Interchanging First Name and Surname
19. Encryption
20. Random Password
21. Translation Table
22. Summary
23. Exercises
6. Functions
1. Introduction
2. What Is a Function
3. Average
4. Calling a Function
5. Several return Statements
6. Least of Three Numbers
7. Least Item of an Array
8. Array As Parameter
9. Function and Subfunction
10. Function without Return Value
11. Replacing Characters in a String
12. Declaration Space
13. The Word Program
14. Override Functions
15. Declaration - Definition
16. Header Files
17. Reference Parameters
18. Parameters with Default Values
19. Recursive Functions
20. Summary
21. Exercises
7. Files
1. Introduction
2. Streams
3. Reading from a Stream
4. Writing to a Stream
5. Attaching a File to a Stream
6. A Complete Write Program
7. A Complete Reading Program
8. New Item at the End of the File
9. Products and Prices
10. Search for a Product Price
11. Sorting a File in Memory
12. Updating File Content
13. Copying Files
14. Summary
15. Exercises
8. Pointers
1. Introduction
2. What Is a Pointer
3. Declaring a Pointer
4. Assigning Values to Pointers
5. Addresses and char Pointers
6. cout and char Pointers
7. Price Program with Pointers
8. Pointer Arithmetics
9. Tax Program
10. Functions and Pointers
11. Dynamic Memory
12. Summary
13. Exercises
9. Structures
1. Introduction
2. What Is a Structure
3. Defining a Structure
4. Declaring and Initiating Structure Variables
5. Assigning Values to Structure Members
6. A Structure Program
7. Array with Structure Variables
8. Pointer to Structure
9. Structures in the Dynamic Memory
10. Structure As Function Parameter
11. Summary
12. Exercises
10. Answers
11. Variables
12. Selections and Loops
13. Arrays
14. Strings
15. Functions
16. Files
17. Pointers
18. Structures
Posting Komentar