array 출력에 관하여...

kanerosars의 이미지

제가 array 타입을 string으로 해서 "test.txt"라는 파일 안에 있는

글자 목록 10개를 안에다가 넣을려고 하거든요?

-----------------------------
[test.txt]
1.c++
2.c
3.c#
.
.
.
10.hornet
-----------------------------

그래서 coding을 대충:

#include
#include
#include
using namespace std;

int main () {
string str;
int n;
string bogus [10];

ifstream myfile("test.txt");
if(myfile.is_open()){
while (! myfile.eof())
{
getline(myfile, str);
for (n=9; n>-1; n--)
{
bogus[n]=str;
}
}
printarray(bogus);
myfile.close();
}

return 0;
}

이렇게 했는데, 그럼 저기 있는 bogus [n] 이라는 array 안에 그 10개의 line들이 입력된건가요??
만약 됐다면요, 그 10개의 line들을 다른 "result.txt"라는 파일에다가 출력하는 방법은 뭐가 있을까요?