char* getline()
{
char in;
int i=0;
char* pOld = new char[1];
char* pNew = new char[1];
while(cin.get(in) && (in != '\n'))
{
i++;
pOld[i]=in;
}
delete [] pNew;
pOld[i] = '\0';
return pOld;
}
char *getline()
{
char in;
int i=0;
char* pOld = new char[1];
while(cin.get(in) && (in != '\n')){
++i;
pOld[i-1] = in;
char* pNew = new char[i+1];
for (int j=0;j<i;++j){
pNew[j] = pOld[j];
}
delete [] pOld;
pOld = pNew;
}
pOld[i] = '\0';
return pOld;
}
Буду рад комментариям и замечаниям!