I want to store a text file in 2D array. I stored it in a 1D array but don't know how to do so in a 2D array.
following is the data set.
T N E M E C N U O N N A G R S
E E L G G R O O M S L I E V O
C E Y E N O M O S L E S N S C
G U D U A A F E C A P A T S I
N Q A C H U R C H O E R L A E
U W L O C D E R N G A R E L T
O E O U X N S S A N S R M C Y
Y Y L R E O I S S G A U A Y G
R T T T C B T A R H N R N A I
D U I G I N C M S I T I T S F
O D N L E T O A O N T H K R T
W I I R I T L N O S E E H O S
R T A O S B A C E R E M O N Y
Y P N U U L O D O N A T I O N
I S C M P P D N A B S U H H S
Album, Announcement, Arrange, Bond, Ceremony, Church, Class, Contract, Court, Crown, Custom, Destiny, Donation, Dowry, Duty, Exchange, Gather, Gentleman, Gifts, Glee, Goals, Groom, Honor, Husband, King, Lady, Money, Nobility, Pace, Parents, Peasant, Plan, Queen, Reason, Responsibility, Ring, Rite, Seal, Serf, Share, Society, Title, Transactions, Union, Veil, Young.
the program I wrote to store it in 1D array is as
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
int main()
{
char buff[500];
ifstream fin ("E:\\hw3\\sample puzzles\\teleword_1.txt");
if (fin.fail())
{
cout<< "Couldn't open File";
}
else
{
while (fin.getline(buff,500))
{
cout<<buff<<endl;
} //end of nested while 1
} //End of main else
return 0;
}
|
just don't know how to store it in a 2D array. Any help would be appreciable.
Ps: I want to store it in a character 2d array.