Solution Manual For C Programming From Problem Analysis To Program Design 8th Edition by Malik ISBN 9781337102087
Solution Manual For C Programming From Problem Analysis To Program Design 8th Edition by Malik ISBN 9781337102087
Soluiton manual:
https://testbankpack.com/p/solution-manual-for-c-programming-from-problem-analysis-to-program-
design-8th-edition-by-malik-isbn-9781337102087/
2-1
Chapter 2
Basic Elements of C++
A Guide to this Instructor’s Manual:
This document is organized chronologically, using the same headings that you see in the
textbook. Under the headings, you will find lecture notes that summarize the section, Teacher
Tips, Classroom Activities, and Lab Activities. Pay special attention to teaching tips and
activities geared towards quizzing your students and enhancing their critical thinking skills.
In addition to this Instructor’s Manual, our Instructor’s Resources also contain PowerPoint
Presentations, Test Banks, and other supplements to aid in your teaching experience.
At a Glance
• Objectives
• Teaching Tips
• Quick Quizzes
• Additional Projects
• Additional Resources
• Key Terms
Lecture Notes
Overview
Chapter 2 teaches your students the basics of C++. Learning a programming language is
similar to learning to be a chef or learning to play a musical instrument. All three
require direct interaction with the tools; in other words, you cannot become proficient
by simply reading books on the topics. In this chapter, your students will begin
acquiring a fundamental knowledge of C++ by learning about data types, functions,
identifiers, assignment statements, arithmetic operations, and input/output operations.
They will then write and test programs using these concepts to verify their knowledge
of the material.
Objectives
In this chapter, the student will:
• Become familiar with the basic components of a C++ program, including functions,
special symbols, and identifiers
• Explore simple data types
• Discover how to use arithmetic operators
• Examine how a program evaluates arithmetic expressions
• Become familiar with the string data type
• Learn what an assignment statement is and what it does
• Learn about variable declaration
• Discover how to input data into memory using input statements
• Become familiar with the use of increment and decrement operators
• Examine ways to output results using output statements
• Learn how to use preprocessor directives and why they are necessary
• Learn how to debug syntax errors
• Explore how to properly structure a program, including using comments to document
a program
• Become familiar with compound statements
• Learn how to write a C++ program
Teaching Tips
Introduction
1. Define the terms computer program and programming.
2. Use the recipe analogy to give students an idea of the process of programming.
© 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in
a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
2-3
1. Note that every C++ program must have a function called main. Use Example 2-1 to
illustrate a basic main function. Walk through this example and point out the
meaning of each line.
Teaching Reassure students that although most of this example probably looks confusing,
Tip they will soon understand it and be comfortable with it.
6. Use Figures 2-2 and 2-3 to describe how memory is allocated and used to store values.
2. Define the terms syntax rules and semantic rules as they relate to a programming
language and explain the difference between the two.
Teaching Emphasize that compilers check for syntax but not semantic errors. Give an
Tip example of each type of error.
Comments
1. Use the program in Example 2-1 to describe the use and importance of comments.
Stress that comments are for the reader, not for the compiler.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of other
ways including checks, online payments and credit card donations. To
donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search facility:
www.gutenberg.org.