I need to read the first letter of each word in a String array in C++. I am trying to translate a message into Pig Latin and I need to be able to determine what the first (and second) letters are. I managed to fill a string array with text from a (txt) file, but I'm really stuck on what to do next. Please help. Thank you!
string *message = NULL;//}
string tempChar, value;//This is dynamically allocating space in the string array
int size = 0; //}
while (Input>>tempChar) {//Getting the size of the array
size++;
}
message = new string[size];
Input.close();//This part is to make sure the file is not read two times
Input.open("example.txt");
cout << "The original message is :\n";
for (int i = 0; i < size; i++) {//This part fills and outputs the original message
Input >> message[i];
cout << message[i] << " ";
}
cout << "\n" << endl;
Input.close();