
-----------------------------------
Geminias
Mon Oct 03, 2005 3:59 pm

quick question
-----------------------------------
is  "cin.getline" deprecated?  (like is it old and unnecessary?)

// cin and ato* functions
#include 
#include 
using namespace std;

int main ()
{
  char mybuffer 

-----------------------------------
wtd
Mon Oct 03, 2005 9:20 pm


-----------------------------------
Do not use std::string::getline, atof, and character arrays.  These make your program very brittle, since they do a poor job of dealing with input that's not exactly what you expect.

Thus we use a std::string which is not limited to 99 characters, as the character array is.

Just as we use the std::cin stream to get input from the keyboard, we can use a stringstream to get input from a string with equal power.

#include 
#include 

int main ()
{
   std::string buffer;
   std::stringstream input_stream;
   float price;
   int quantity;

   std::cout > price;

   std::cout > quantity;

   std::cout 