Source of name_address.cpp


  1: //name_address.cpp
  2: //Displays two names and addresses.

  4: #include <iostream>
  5: #include <iomanip>
  6: using namespace std;

  8: int main()
  9: {
 10:     cout << "\nThis program displays two names and addresses, "
 11:         "each having the same format.\nHowever, the format of "
 12:         "each name/address pair is achieved in a different way.\n\n";

 14:     //Display a first name and address
 15:     cout << "  Andrew Williams\n"
 16:         "\t123 Main Avenue\n"
 17:         "\tHalifax, NS\n"
 18:         "\tB3H 3C3\n\n";

 20:     //Display a second name and address
 21:     cout << setw(18) << "Angela Williams\n";
 22:     cout << setw(8)  << "" << "123 Main Avenue\n";
 23:     cout << setw(8)  << "" << "Halifax, NS\n";
 24:     cout << setw(8)  << "" << "B3H 3C3\n";
 25:     cout << endl;
 26: }