A Modular Structured Approach Using C++ © Kenneth Leroy Busbee
Total Page:16
File Type:pdf, Size:1020Kb
Programming Fundamentals -A Modular Structured Approach using C++ © Kenneth Leroy Busbee This work is licensed under a Creative Commons-ShareAlike 4.0 International License Original source: Multimedia Educational Resource for Learning and Online Teaching http://www.merlot.org/merlot/viewMaterial.htm?id=515164 Contents Preface .............................................................................................................................1 Orientation and Syllabus ...............................................................................................2 Chapter 1 Introduction to Programming ....................................................................4 1.1 Systems Development Life Cycle .....................................................................................4 1.1.1 Discussion ................................................................................................................4 1.1.2 Definitions ...............................................................................................................5 1.2 Bloodshed Dev-C++ 5 Compiler/IDE ................................................................................6 1.2.1 Introduction ............................................................................................................6 1.2.2 Bloodshed Dev-C++ 5 compiler/IDE .....................................................................6 1.2.3 Preparation before Installation ............................................................................7 1.2.3.1 Creating the Needed Folders and Sub-Folders .......................................7 1.2.3.2 Getting the Software ...................................................................................8 Tip ......................................................................................................................8 1.2.3.3 Getting a C++ Source Code File .................................................................8 1.2.4 Installation Instructions for Bloodshed Dev-C++ 5 compiler/IDE .....................8 1.2.4.1 Computer Installation Instructions ...........................................................9 1.2.4.2 Flash Drive Installation Instructions .........................................................9 1.3 Modularization and C++ Program Layout ....................................................................10 1.3.1 Concept of Modularization ..................................................................................10 1.3.2 Introduction of Functions within C++ ................................................................11 1.3.2.1 Program Control Function .......................................................................13 1.3.2.2 Specifc Task Function ...............................................................................13 1.3.3 C++ Program Layout ............................................................................................14 1.3.4 Definitions .............................................................................................................15 1.4 Practice 1: Introduction to Programming .....................................................................16 1.4.1 Learning Objectives ..............................................................................................16 1.4.2 Memory Building Activities ..................................................................................16 1.4.3 Exercises ................................................................................................................16 1.4.4 Miscellaneous Items ............................................................................................17 1.4.5 Lab Assignment ....................................................................................................17 1.4.5.1 Creating a Folder or Sub-Folder for Chapter 01 Files ...........................17 1.4.5.2 Download the Lab File(s) ..........................................................................17 1.4.5.3 Detailed Lab Instructions .........................................................................17 1.4.6 Problems ...............................................................................................................18 1.4.6.1 Problem 01a -Instructions ........................................................................18 1.4.7 Solutions to Exercises in Chapter 1 ....................................................................19 Chapter 2 Program Planning & Design ......................................................................20 2.1 Program Design ...............................................................................................................20 2.1.1 Topic Introduction ................................................................................................20 2.1.2 Understanding the Program ...............................................................................20 2.1.3 Using Design Tools to Create a Model ...............................................................20 2.1.4 Develop Test Data ................................................................................................21 2.1.5 Definitions .............................................................................................................21 2.2 Pseudocode ......................................................................................................................22 2.2.1 Overview ................................................................................................................22 2.2.2 Definitions .............................................................................................................23 2.3 Test Data ...........................................................................................................................23 2.3.1 Overview ................................................................................................................23 2.3.2 Creating Test Data and Model Checking ...........................................................24 2.3.3 Testing the Coded Program -Code Checking ....................................................24 2.3.4 Definitions .............................................................................................................25 2.4 Practice 2: Program Planning & Design ........................................................................25 2.4.1 Learning Objectives ..............................................................................................25 2.4.2 Memory Building Activities ..................................................................................25 2.4.3 Exercises ................................................................................................................26 2.4.4 Miscellaneous Items ............................................................................................26 2.4.5 Lab Assignment ....................................................................................................26 2.4.5.1 Creating a Folder or Sub-Folder for Chapter 02 Files ...........................26 2.4.5.2 Download the Lab File(s) ..........................................................................26 2.4.5.3 Detailed Lab Instructions .........................................................................27 2.4.6 Problems ...............................................................................................................28 2.4.6.1 Problem 02a -Instructions ........................................................................28 2.4.6.2 Problem 02b -Instructions .......................................................................28 2.4.7 Solutions to Exercises in Chapter 2 ....................................................................28 Chapter 3 Data & Operators .......................................................................................29 3.1 Data Types in C++ ............................................................................................................29 3.1.1 General Discussion................................................................................................29 3.1.2 Definitions .............................................................................................................31 3.2 Identifier Names ..............................................................................................................31 3.2.1 Overview ................................................................................................................31 3.2.2 Technical to Language .........................................................................................31 3.2.3 Good Programming Techniques ........................................................................32 3.2.4 Industry Rules .......................................................................................................32 3.2.5 Definitions .............................................................................................................32 3.3 Constants &Variables ......................................................................................................33 3.3.1 Understanding Constants ...................................................................................33 3.3.2 Defining Constants & Variables ..........................................................................34 3.3.3 Definitions .............................................................................................................34 3.4 Data Manipulation ...........................................................................................................35