#include <iostream>
#include <string>
using std::cin; using std::cout; using std::endl;
#define MEMO_CNT 5
#define MEMO_LENGTH 1024
int main()
{
char *p[MEMO_CNT];
char buf[MEMO_LENGTH];
char *conch[MEMO_CNT];
for(int i=0; i<MEMO_CNT; i++)
{
cout << i+1 << "번째 입력 : ";
fflush(stdin);
cin.getline(buf, MEMO_LENGTH);
p[i] = new char[strlen(buf)+1];
strcpy(p[i], buf);
}
cout << endl;
for(i=0; i<MEMO_CNT; i++)
{
cout << i+1 << "번째 출력 : ";
cout << p[i] << endl;
}
cout << endl;
cout << "연결 출력\n";
for(i=0; i<MEMO_CNT; i++)
{
conch[MEMO_CNT] = new char[strlen(buf)+1];
}
strcpy(conch[MEMO_CNT], buf);
for(i=0; i < MEMO_CNT; i++)
{
//cout << p[i];
strcat(conch[MEMO_CNT], p[i]);
}
cout << conch[MEMO_CNT] << endl;
for(i=0; i<MEMO_CNT; i++)
{
delete [] p[i];
}
cout << endl;
return 0;
}