/*************************************************************************************
Author: Eric Breimer
File: intstr.h
Description: Provides a function for converting an integer to a string
*************************************************************************************/
#ifndef INTSTR_H
#define INTSTR_H

#include <string>
#include <algorithm>

using std::string;
using std::reverse;

/*************************************************************************************
Description: Converts an integer into a string
Input:  integer x
Output: string
*************************************************************************************/
string intstr(int x) {
  string a;
  while (x > 0) {
    a += '0' + (x % 10);
    x /= 10;
  }
  reverse(a.begin(),a.end());
  return a;
}
#endif
