Average

//
// FILE:        average.cxx
// AUTHOR:      J Wyatt for CIS 163 section xx
// DATE:        02/11/2000
//
/* PURPOSE:     This program greets the user and then
                accepts two integer values and averages
                them.
                ------------------------------------
   PLAN:        get the name from the user
                display greeting
                ask user for numbers
                compute average
                output average
--------------------------------------------------------*/

#include <iostream>
#include <string>

using namespace std;

int main()
 {

  int num1,  num2;      // the input data
  float average;
  string name;          // name of user
  string border="******************************";


// get user name & display greeting
 cout << "What is your name?  ";
 cin >> name;
 cout << "Hello " << name << endl;

// get the numbers to be averaged
 cout << "Enter a number: " ;
 cin >> num1;
 cout << "Enter a number: " ;
 cin >> num2;

// computation - force float by using 2.0
 average = (num1 + num2) / 2.0;

// give the user the info in a report
 cout << border << endl;
 cout << "Username: " << name << endl
                                                      
// computation - force float by using 2.0
 average = (num1 + num2) / 2.0;

// give the user the info in a report
 cout << border << endl;
 cout << "Username: " << name << endl
      << "Numbers Entered: " << num1 << " and  " << num2 << endl;
 cout << "The average is " << average << endl
      << "END REPORT FOR " << name << endl;
 cout << border;
 
 return 0;
}