<< Chapter < Page Chapter >> Page >
Questions, exercises, problems, etc. that support this chapter in the "Programming Fundamentals - A Modular Structured Approach using C++" collection/textbook.

Learning objectives

With 100% accuracy during a: memory building activity, exercises, lab assignment, problems, or timed quiz/exam; the student is expected to:

  1. Define the terms on the definitions as listed in the modules associated with this chapter.
  2. Be able to list the categories and give examples of errors encountered when using an Integrated Development Environment (IDE).
  3. Write the C++ code for a program using appropriate planning documentation that you or another has designed.

Memory building activities

Link to: MBA 05

Exercises

    Answer the following statements as either true or false:

  1. IDE means Integer Division Expression.
  2. Most modern compilers are really an IDE type of software, not just a compiler.
  3. cin and cout are used for the standard input and output in C++.
  4. Programming errors are extremely easy to understand and fix.
  5. All C++ programs will have at least one include type of compiler directive.

    Answers:

  1. false
  2. true
  3. true
  4. false
  5. true
Got questions? Get instant answers now!

Miscellaneous items

None at this time.

Lab assignment

Creating a folder or sub-folder for chapter 05 files

Depending on your compiler/IDE, you should decide where to download and store source code files for processing. Prudence dictates that you create these folders as needed prior to downloading source code files. A suggested sub-folder for the Bloodshed Dev-C++ 5 compiler/IDE might be named:

  • Chapter_05 within the folder named: Cpp_Source_Code_Files

If you have not done so, please create the folder(s) and/or sub-folder(s) as appropriate.

Download the lab file(s)

Download and store the following file(s) to your storage device in the appropriate folder(s). You may need to right click on the link and select "Save Target As" in order to download the file.

Download from Connexions: Solution_Lab_02_Pseudocode.txt

Download from Connexions: Solution_Lab_02_Test_Data.txt

Detailed lab instructions

Read and follow the directions below carefully, and perform the steps in the order listed.

  • Copy into your sub-folder: Chapter_05 one of the source code listings that we have used. We suggest the Lab 01 source code and rename the copy: Lab_05.cpp
  • Modify the code to follow the Solution_Lab_02_Pseudocode.txt file.
  • Build (compile and run) your program. You have successfully written this program if when it runs and you use the test data [use the test data as supplied as the solution for Lab 02] it gives the predicted results.
  • After you have successfully written this program, if you are taking this course for college credit, follow the instructions from your professor/instructor for submitting it for grading.

Problems

Problem 05a – instructions

List and describe what might cause the four (4) types of errors encountered in a program using an Integrated Development Environment software product.

Problem 05b – instructions

Identify four (4) problems with this code listing (HINT: The four (4) types of errors encountered in a program using an Integrated Development Environment software product).

C++ source code listing

//****************************************************** // Filename: Compiler_Test.cpp// Purpose: Average the ages of two people // Author: Ken Busbee; © Kenneth Leroy Busbee// Date: Jan 5, 2009 // Comment: Main idea is to be able to // debug and run a program on your compiler.//****************************************************** // Headers and Other Technical Items#include<iostrern>using namespace std;// Function Prototypes void pause(void);// Variables int age1;int age2; double answear;//****************************************************** // main//****************************************************** int main(void){ // Inputcout<<"\nEnter the age of the first person --->: "; cin>>age1; cout<<"\nEnter the age of the second person -->: "; cin>>age2; // Processanswer = (age1 + age2) / 3.0; // Outputcout<<"\nThe average of their ages is -------->: "; cout<<answer; pause();return 0; }//****************************************************** // End of Program//******************************************************

Got questions? Get instant answers now!

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Programming fundamentals - a modular structured approach using c++. OpenStax CNX. Jan 10, 2013 Download for free at http://cnx.org/content/col10621/1.22
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Programming fundamentals - a modular structured approach using c++' conversation and receive update notifications?

Ask