Skip to main content
added 9 characters in body
Source Link

I have a text file called aisha

This is a new file I did it for mediu.
Its about Removing stopwords fRom the file
and apply casefolding to it
I Tried doing that many Times
and finally now I could do

and I did a code to read that text file and save it into an array and then convert some characters to lowrcase but what I want is to to make the codes reads the file as a string not char

char myArray[200]; to be  

to be

`string myArray[200];`

I think I can do it using the function tolower()and a string std insted that long code I used but I dont know how to change my code to a code that uses that functions

my code is

#include <iostream>
#include <string>
#include <fstream>
#include<ctype.h>
int main()
{
    using namespace std;

    ifstream file("aisha.txt");
    if(file.is_open())
    {
        file >> std::noskipws;
         char myArray[200];

        for(int i = 0; i < 200; ++i)
        {
        
            
            cout<<"i";
            if (myArray[i]=='A')
            cout<<"a";
            if (myArray[i]=='T')
            cout<<"t";
            if (myArray[i]=='R')
            cout<<"r";
            else 
            if (myArray[i]!='I' && myArray[i]!='T' && myArray[i]!='R'&& myArray[i]!='A')
            cout<<myArray[i];
            }
         file.close();
            
        }
    
system("PAUSE");
return 0;
}

I saw that solution in this site but I couldnt apply it to my code

#include <boost/algorithm/string.hpp>    

std::string str = "wHatEver";
boost::to_lower(str);

Otherwise, you may use std::transform:

std::string str = "wHatEver";
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
    

I have a text file called aisha

This is a new file I did it for mediu.
Its about Removing stopwords fRom the file
and apply casefolding to it
I Tried doing that many Times
and finally now I could do

and I did a code to read that text file and save it into an array and then convert some characters to lowrcase but what I want is to to make the codes reads the file as a string not char

char myArray[200]; to be  `string myArray[200];`

I think I can do it using the function tolower()and a string std insted that long code I used but I dont know how to change my code to a code that uses that functions

my code is

#include <iostream>
#include <string>
#include <fstream>
#include<ctype.h>
int main()
{
    using namespace std;

    ifstream file("aisha.txt");
    if(file.is_open())
    {
        file >> std::noskipws;
         char myArray[200];

        for(int i = 0; i < 200; ++i)
        {
        
            
            cout<<"i";
            if (myArray[i]=='A')
            cout<<"a";
            if (myArray[i]=='T')
            cout<<"t";
            if (myArray[i]=='R')
            cout<<"r";
            else 
            if (myArray[i]!='I' && myArray[i]!='T' && myArray[i]!='R'&& myArray[i]!='A')
            cout<<myArray[i];
            }
         file.close();
            
        }
    
system("PAUSE");
return 0;
}

I saw that solution in this site but I couldnt apply it to my code

#include <boost/algorithm/string.hpp>    

std::string str = "wHatEver";
boost::to_lower(str);

Otherwise, you may use std::transform:

std::string str = "wHatEver";
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
    

I have a text file called aisha

This is a new file I did it for mediu.
Its about Removing stopwords fRom the file
and apply casefolding to it
I Tried doing that many Times
and finally now I could do

and I did a code to read that text file and save it into an array and then convert some characters to lowrcase but what I want is to to make the codes reads the file as a string not char

char myArray[200];

to be

`string myArray[200];`

I think I can do it using the function tolower()and a string std insted that long code I used but I dont know how to change my code to a code that uses that functions

my code is

#include <iostream>
#include <string>
#include <fstream>
#include<ctype.h>
int main()
{
    using namespace std;

    ifstream file("aisha.txt");
    if(file.is_open())
    {
        file >> std::noskipws;
         char myArray[200];

        for(int i = 0; i < 200; ++i)
        {
        
            
            cout<<"i";
            if (myArray[i]=='A')
            cout<<"a";
            if (myArray[i]=='T')
            cout<<"t";
            if (myArray[i]=='R')
            cout<<"r";
            else 
            if (myArray[i]!='I' && myArray[i]!='T' && myArray[i]!='R'&& myArray[i]!='A')
            cout<<myArray[i];
            }
         file.close();
            
        }
    
system("PAUSE");
return 0;
}

I saw that solution in this site but I couldnt apply it to my code

#include <boost/algorithm/string.hpp>    

std::string str = "wHatEver";
boost::to_lower(str);

Otherwise, you may use std::transform:

std::string str = "wHatEver";
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
    
Source Link

convert strings to lowercase characters using tolower() function in c++

I have a text file called aisha

This is a new file I did it for mediu.
Its about Removing stopwords fRom the file
and apply casefolding to it
I Tried doing that many Times
and finally now I could do

and I did a code to read that text file and save it into an array and then convert some characters to lowrcase but what I want is to to make the codes reads the file as a string not char

char myArray[200]; to be  `string myArray[200];`

I think I can do it using the function tolower()and a string std insted that long code I used but I dont know how to change my code to a code that uses that functions

my code is

#include <iostream>
#include <string>
#include <fstream>
#include<ctype.h>
int main()
{
    using namespace std;

    ifstream file("aisha.txt");
    if(file.is_open())
    {
        file >> std::noskipws;
         char myArray[200];

        for(int i = 0; i < 200; ++i)
        {
        
            
            cout<<"i";
            if (myArray[i]=='A')
            cout<<"a";
            if (myArray[i]=='T')
            cout<<"t";
            if (myArray[i]=='R')
            cout<<"r";
            else 
            if (myArray[i]!='I' && myArray[i]!='T' && myArray[i]!='R'&& myArray[i]!='A')
            cout<<myArray[i];
            }
         file.close();
            
        }
    
system("PAUSE");
return 0;
}

I saw that solution in this site but I couldnt apply it to my code

#include <boost/algorithm/string.hpp>    

std::string str = "wHatEver";
boost::to_lower(str);

Otherwise, you may use std::transform:

std::string str = "wHatEver";
std::transform(str.begin(), str.end(), str.begin(), ::tolower);