File input problem : newline

Hello! I'm one of the students major in computer science in undergraduate.

But, I'm just freshman student in our university.
And an assignment of our class is too difficult for me.



Purpose of this program : file input problem.
Conditions :

1) input.txt

The content of this text file is

apple
banana
pineapple
kiwi

so, I must make the program to input this words to
2-dimensional character type variables.

For example,

char word[20][20];

word[0][1] = 'a';
word[0][2] = 'p';
word[0][3] = 'p';
word[0][4] = 'l';
word[0][5] = 'e'; // the first row was full of word, apple.

word[1][o] = 'b';
word[1][1] = 'a';
word[1][2] = 'n';
word[1][3] = 'a';
word[1][4] = 'n';
word[1][5] = 'a'; // the second row was full of word, banana.


I don't know what to do in this problem....
I'd love to help, but I just don't know where to start. If you can give an honest response to these, we can proceed.

Do you know what a C string is and can you use it?
Do you know how to open a file and read it's content into a string?
Do you know what an array is?
Do you know how to declare an array of C strings?
Topic archived. No new replies allowed.