Here's the code I've been working on for my Chinese character look up program. Please remember I'm a rookie, teaching myself c++ :P I did get a book but it's too limited as far as getline() and multi-dimensional arrays. What's the best way to feed a multi-dimensional array with getline() reading a text/data file?
BTW, thanks Pelp for the help on reading data into a one-dim. array.
Thanks for any tips/suggestions you can throw my way.
void FeedRadArray(int numrad_strokes);
void DisplayRads(int numrad_strokes);
using namespace std;
const int MaxRadsInRow = 51;
cout<<"How many strokes are there in the radical? "<<endl;
/* send ns to a function that reads the radicals
from the file into the radical array */
cout<<endl<<"Please choose from the following radicals:"<<endl;
// cout<<"You chose "<<y<<". "<<radindex??[y]<<endl;
cout<<"How many strokes are there in the rest of the character? "<<endl;
// DisplayHanzi(rad_choice, remaining strokes);
/* Send rad_choice and remaining_strokes to a function that displays the radical and
the characters under that radical with that many remaining strokes */
cout<<"Which of the following is the character you're looking for? ";
void FeedRadArray(int numrad_strokes)
ifstream a_file("c:\\Downloads\\C_Source\radicals3.txt"); //opens the file for reading
a_file.close(); //don't forget this!
void DisplayRads(int numrad_strokes)
int x = numrad_strokes - 1; //PREPARES numrad_strokes FOR USE IN ARRAY
for(int y=0; y<=MaxRadsInRow; y++)
if (y % 2 != 0)
cout<<" "<<y+1<<". "<<radindex[x][y];