SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. char *getline()
  2. {
  3.     char input;
  4.     int size = 4;
  5.     char*p = new char[size];
  6.     int i = 0;
  7.  
  8.     while (cin.get(input) && input != '\n')
  9.     {      
  10.         if (i>=size)
  11.         {          
  12.             p=resize(p,size,size*2);
  13.             size *=2;
  14.         }
  15.         p[i] = input;
  16.         i++;
  17.     }
  18.     p[i] = '\0';
  19.     return p;
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top