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?
This is what I have done:
{ 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 {
while (arr[j][k]!='\0')
{
c=arr[j][k];
cout<<"C"< val=int(c);
if (val>=65&&val<=90){ val=val+32;fin_char=static_cast(val);arr[j][k]=fin_char;}
k++;
}
}
for (int j=0;j {
cout<<" "< }
The output I get is of the form:
C 99 J:0 K:0
C 111 J:0 K:1
C 110 J:0 K:2
C 110 J:0 K:3 `