I am reading from a file which has words like:
"connecting", "classes", "feeds"..
I need to convert each character to lowercase and then call a function to remove suffix from each word. Say, first on connecting, then on classes...
I am done with rest of the part but have a problem reading the file and storing words in array.
I will have a minimum of 50 such words in the file. What is the best way to store it?
{
    int val=0; char fin_char;    
    string line;string arr[100];    
    ifstream myfile("testfile.txt"); 
    if (myfile.is_open())
    {
        while(myfile.good())
        {
            getline(myfile,line); 
            arr[i]=line; 
            i++;
        }   
        myfile.close(); 
        for (int j=0;j<i;j++)
        {
            while (arr[j][k]!='\0')
            {
                c=arr[j][k];
                cout<<"C"<<c<<" "<<"J:"<<" "<<j<<"K:"<<k<<"\n";
                val=int(c);
                if (val>=65&&val<=90){ val=val+32;fin_char=static_cast<char>(val);arr[j][k]=fin_char;}
                k++;
            }
        }   
        for (int j=0;j<i-1;j++)
        {
            cout<<" "<<arr[j]<<"\n";
        }   
        system("pause");
        return 0;
    }
This is the output I get:
 C99 J:0 K:0 C111 J:0 K:1 C110 J:0 K:2 C110 J:0 K:3
 
     
     
    