// ADAMS.cc   P. Conrad 9/14/05
// demonstrate some stuff about character arrays
// in C++

#include <iostream>
using namespace std;


int main(void)
{
  char name[6] = "ADAMS";

  // three parts to a for loop:
  //   initialization; test; increment


  int i;

  for ( i = 0; i<6; i++)
    {
      cout << "i=" << i << " the ith char of name is " << name[i] << endl;
    }


  cout << "After the first for loop, value of i=" << i << endl;

  char binNumber[9] = "01000001";

  for (     i = 0; i<9; i++)
    {
      cout << "i=" << i << " the ith char of binNumber is " << binNumber [i] << endl;
    }

  cout << "After the second for loop, value of i=" << i << endl;

  cout << "Now I will change the last bit of the binary number\n"
       << "from a 1 to a zero, and the 2nd to the last bit from\n"
       << "a zero to a one" << endl;

  binNumber[7]= '0';
  binNumber[6]= '1';

  for (     i = 0; i<9; i++)
    {
      cout << "i=" << i << " the ith char of binNumber is " << binNumber [i] << endl;
    }

  
  return 0;


}


