Programming Fundamentals/Practice: Integrated Development Environment

From Wikibooks, open books for an open world
Jump to navigation Jump to search

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

Learning Objectives[edit | edit source]

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.

Exercises[edit | edit source]

Exercise 1[edit | edit source]

Answer the following statements as either true or false:[edit | edit source]

  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

Miscellaneous Items[edit | edit source]

None at this time.

Lab Assignment[edit | edit source]

Creating a Folder or Sub-Folder for Chapter 05 Files[edit | edit source]

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)[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Problem 05a – Instructions[edit | edit source]

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[edit | edit source]

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).

Example 1: C++ Source Code Listing[edit | edit source]

//******************************************************
// 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)
{
    // Input	
    cout << "\nEnter the age of the first person --->: ";
    cin >> age1;
    cout << "\nEnter the age of the second person -->: ";
    cin >> age2;

    // Process
    answer = (age1 + age2) / 3.0;

    // Output
    cout << "\nThe average of their ages is -------->: ";
    cout << answer;

    pause();
    return 0;
}

//******************************************************
// End of Program
//******************************************************