// readUsernames.cpp
// P.Conrad, Spring 2004
// CISC181, A program to read usernames from the command line
// Demonstrates reading usernames from the command line
// and outputting a web page to access those names.

#include <iostream>

using std::cout;
using std::cin;
using std::flush;

int main(void)
{

  const int MAX_USERNAME_LENGTH = 8; // restriction of 8 comes from Unix rules

  char username[MAX_USERNAME_LENGTH+1];  // +1 because of \0

  // prompt for, and read in, a username.
  
  cout << "Enter a username for a CISC181 student (CTRL/D to end): " << flush;
  cin >> username;

  while (!cin.eof())  // will stop at end of file, or at CTRL/D
    {

      // convert username into URL and print it out

      cout << "You can use \n"
	   << " http://copland.udel.edu/~" << username << "/cisc181/files/lab00/collegeDat.txt\n"
	   << "to access this students college information" << endl;
      
      // get the next username

      cout << "Enter another username for a CISC181 student (CTRL/D to end): " << flush;      
      cin >> username;
      

    }

  // a parting thought

  cout << "\nThank you, and goodbye!" << endl;


  return 0;
} 


