You are here

Problem 05b -Instructions

5 February, 2015 - 17:22

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 5.3: 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 agel; int age2; double answear; //****************************************************** 
// main 
//****************************************************** 
int main(void) 
  { 
  // Input 
  cout « "\nEnter the age of the first person --->: "; 
  cin » agel; 
  cout « "\nEnter the age of the second person -->: "; 
  cin » age2; 

// Process 
answer = (agel + age2) / 3.0; 
// Output 
cout « "\nThe average of their ages is -------->: "; 
cout « answer; 
pause(); 
return 0; 
} 
//****************************************************** 
// End of Program 
//******************************************************