#include #include #include typedef unsigned int Uint; typedef char * String; const Uint size = 64; int read_strings(istream& in, String strs[], Uint maxstrs) { Uint k, n=0; String s; char buffer[size]; while( in >> buffer ) // read string into buffer { k = 1 + strlen(buffer); if (n >= maxstrs || (s = new char[k]) == NULL) return(-1); // error else { strcpy(s, buffer); // copy buffer into s strs[n++] = s; // put s on array strings } } return(n); // number of strings read } int main() { String strs[100]; int i = read_strings(cin, strs, 100); for ( int j = 0; j < i; j++) cout << strs[j] << "\n"; return(0); }