// getThings.cpp   Implementation for getThings.h
// P. Conrad, for CISC181, Fall 2004
// This is not a "class".  It is just a library of useful routines
// for "getting" characters and integers from cin.   See the .h file
// for more information.

#include <iostream>
using std::cin;

#include <cstdlib>
using std::atoi;

char getFirstCharacter(void)
{
  // reads in an entire line of text up to the newline,
  // returns the first character read, and throws away the rest
  const int bufSize=80;
  char buffer[bufSize];
  cin.getline(buffer, bufSize, '\n');
  return buffer[0];
}

int getFirstInteger(void)
{
  // reads in an entire line of text up to the newline,
  // convert the first integer you find in the string
  //   from ascii to integer (atoi)
  // if conversion can't be performed, atoi returns 0

  const int bufSize=80;
  char buffer[bufSize];
  cin.getline(buffer, bufSize, '\n');
  return atoi(buffer);
}

