In my program I have a text file that is read into an array that tokenizes each word. I need it this way so that I can compare the words to the words found in my Binary Tree. Issue is... some duplicates of words are not formatted the same way (one is uppercase and one is lowercase) and I need them to be so they can be found in my Binary Tree.
So my question is: How do I change my whole array to lowercase?
Here is what I tried so far:
#include <iostream>
#include "Binary_SearchTree.h"
#include "Node.h"
#include <string>
#include <fstream>
#include <sstream>
using namespace std;
const int SIZE = 100;
string myArray[SIZE];
int main() {
// first constructor will be used since it is empty
Binary_SearchTree<string> *tree = new Binary_SearchTree<string>();
string token, lines;
ifstream file("hashtags.txt");
while (getline(file, lines)){
tree -> insertNode(lines);
}
// Convert all strings in myArray to all-lower
myArray = tolower(myArray);
// tokenize tweet into an array to search
ifstream tweet1("exampleTweet.txt");
if(tweet1.is_open())
{
while (getline(tweet1, token)){
for(int i = 0; i < SIZE; ++i)
{
tweet1 >> myArray[i];
}
}
tweet1.close();
}