// readUsernames.cpp
// P.Conrad, Fall 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): ";
  cin >> username;

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

      // convert username into URL and print it out

      cout << "\n"
	   << "You can use \n"
	   << "    http://copland.udel.edu/~" << username << "/cisc181\n"
	   << "  to access this student's CISC181 web page\n" 
	   << endl; // an extra blank line at the end.
      
      // get the next username

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

  // a parting thought

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


  return 0;
} 


