C++ Language, Only the sort_i_before_e func, not included main.
Also, plz look at the instructions. use vector.

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks
#include<iostream>
#include <vector>
#include <string>
using Words = std::vector<std::string>;
using Word = std::string;
using namespace std;
Words input ={"happy","achieve","ceiling",
"beige","species","eight","ei",
"ie","cie","cei","thei","thie",
"thcie","thcei","ten"
};
Words follows_rule,violates_rule,inapplicable_rule;
Words follows_rule_expected={"achieve","ceiling","ie","cei","thie","thcei"};
Words violates_rule_expected={"beige","species","eight","ei","cie","thei","thcie"};
Words inapplicable_rule_expected={"happy","ten"};
//required method
void sort_i_before_e(Words input, Words &follows_rule, Words &violates_rule,Words ¬_applicable){
//looping through each word in input vector
for(int i=0;i<input.size();i++){
string word=input[i];
//finding index of 'ie' in word
size_t index=word.find("ie");
//checking if ie exists
if(index!=string::npos){
//exists, checking if c comes before ie
if(index-1 >=0){
if(word[index-1]=='c'){
//c comes before ie, violation
violates_rule.push_back(word);
}else{
//nope! follows the rule
follows_rule.push_back(word);
}
}else{
//no previous character, meaning follows the rule
follows_rule.push_back(word);
}
}
//otherwise checking if ei exists
else if(word.find("ei")!=string::npos){
//finding index of ei
index=word.find("ei");
if(index-1 >=0){
//checking if previous character is not c
if(word[index-1]!='c'){
//nope! violation of rule
violates_rule.push_back(word);
}else{
//yes, its a c, follows the rule
follows_rule.push_back(word);
}
}else{
//no previous char, its a violation
violates_rule.push_back(word);
}
}else{
//neither ei or ie exists, not applicable
not_applicable.push_back(word);
}
}
}
//a helper method to print the vector of words for demonstration
void printVector(Words v){
cout<<"{";
for(int i=0;i<v.size();i++){
cout<<v[i];
if(i!=v.size()-1){
cout<<", ";
}
}
cout<<"}"<<endl;
}
int main(){
//testing
sort_i_before_e(input,follows_rule,violates_rule,inapplicable_rule);
cout<<"Words follow rule expected: ";
printVector(follows_rule_expected);
cout<<"Words follow rule got: ";
printVector(follows_rule);
cout<<"Words violates rule expected: ";
printVector(violates_rule_expected);
cout<<"Words violates rule got: ";
printVector(violates_rule);
cout<<"Words inapplicable rule expected: ";
printVector(inapplicable_rule_expected);
cout<<"Words inapplicable rule got: ";
printVector(inapplicable_rule);
return 0;
}
/*OUTPUT*/
Words follow rule expected: {achieve, ceiling, ie, cei, thie, thcei}
Words follow rule got: {achieve, ceiling, ie, cei, thie, thcei}
Words violates rule expected: {beige, species, eight, ei, cie, thei, thcie}
Words violates rule got: {beige, species, eight, ei, cie, thei, thcie}
Words inapplicable rule expected: {happy, ten}
Words inapplicable rule got: {happy, ten}
C++ Language, Only the sort_i_before_e func, not included main. Also, plz look at the instructions. use...
C++ Language:
TestCase:
Write a function, called "sort Lbefore e that can sort words into whether or not they conform to the 1 beforee, except after c rule, See htrps//en.oxtorddictionaries.com/spelling/-before-e-except-after-cl. This function takes 4 references to vectors of strings as parameters . The first vector is the input consisting of lowercase words (only alphabetic charactersl. The next vector should be filled with words that follow the rule The next vector should be filled with words that don't have ie or...
C++Language:
The question is not allowed to use STL. Also, plz use noskipws
and push_back for the question.The input is more than one, so the
code should be able to run more than once
Strings are vectors words on that line and the line itself. What's a word? It is a series of alphabetic characters, separated by whitespace other non-alphabetic characters. Write a program that reads from cin and tor each line, outputs number Pretty easy huh, well, you aren't...
I need my c++ code converted to MASM (assembly language). The instructions below: write an assembly program that does the following; 1. count and display the number of words in the user input string. 2. Flip the case of each character from upper to lower or lower to upper. For example if the user types in: "Hello thEre. How aRe yOu?" Your output should be: The number of words in the input string is: 5 The output string is : hELLO...
C++ SECTION 1) (15 points) Write a full C++ program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. Assume at least one word in the list will contain the given character. Ex: If the input is: 4 hello zoo sleep drizzle z then the output is: 200 drizzle To...
Hello, I need to implement these small things in my C++ code. Thanks. 1- 10 characters student first name, 10 characters middle name, 20 characters last name, 9 characters student ID, 3 characters age, in years (3 digits) 2- Open the input file. Check for successful open. If the open failed, display an error message and return with value 1. 3- Use a pointer array to manage all the created student variables.Assume that there will not be more than 99...
C++ assignment help! The instructions are below, i included the main driver, i just need help with calling the functions in the main function This assignment will access your skills using C++ strings and dynamic arrays. After completing this assignment you will be able to do the following: (1) allocate memory dynamically, (2) implement a default constructor, (3) insert and remove an item from an unsorted dynamic array of strings, (4) use the string class member functions, (5) implement a...