You are here

Problem 06b -Instructions

6 February, 2015 - 10:13

Identify some problems that make this code "undocumented", "unreadable" or wrong in some other way.

Example 6.9: C++ source code

//******************************************************// Author: Ken Busbee;  © 2009 Kenneth Leroy Busbee// Date: Jan 17, 2009//******************************************************

#include <iostream>using namespace std;

void pause(void);

int age1, age2;double xx;

//******************************************************// main//******************************************************
int main(void)  {  // Inputcout << "\nEnter the age of the first person --->: ";  cin  >> age1;    cout  << "nnEnter the age of the second person -->: ";  cin  >> age2;
  // Process  xx = (age1 + age2) / 2.0;
  // Output  cout << "\nThe average of their ages is -------->: ";  cout << xx;

  pause();  return 0;  }

void pause(void)  { cout << "\n\n";  system("PAUSE");  cout << "\n\n";  return; }

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