//Programmer: Bo Bayles  Date: 2 November 2004
//File: lab11.cpp        Class: CS54 C
//Purpose: This program demonstrates the problems of using the >> operator
//  and the getline functions, then solves them in various ways.

#include <string>
#include <iostream>
using namespace std;

void newline();

int main()
{
  //char word[16];
  string word;
  //char def[81];
  string def;

  cout << endl
       << "========================" << endl
       << "Dictionary Entry Program" << endl;

  cout << endl << "Enter a word: ";
  cin >> word;
  //Possible solution:
  //cin.getline(word, 16);

  //The >> operator still leaves the newline in the stream, and getline reads
  //  until the newline, so cin.ignore still needs to be used.
  //cin.ignore();
  newline();


  cout << "Enter the definition of the word: ";
  //cin.getline(def, 81);
  getline(cin, def);

  //Possible solution: Do another
  //cin.getline(def, 81);

  cout << "\n";

  cout << word << " - " << def << endl;

  cout << endl << "Exiting..." << endl
       << "========================" << endl;

  return 0;
}

void newline()
{
  char cInput;

  while (cInput != '\n')
    cin.get(cInput);

  return;
}
//Read one character from the input stream until there's a newline, then break
//  and return nothing.

