title: C++ searching a line from a file for certain words and then inserting a word after those words
body: <p>Im very new to C++ and ive been struggling for quite a while trying to figure out how to do this problem. Basically, i need to read from a file and find all instances of an article ("a","A","an","aN","An","AN","the","The","tHe","thE","THe","tHE","ThE","THE")and then insert an adjective after that article. The adjective's capitalization must be based on the word originally in front of the article. For instance, if i found "a SHARK" i would need to make it "a HAPPY SHARK." Can anyone tell me what the best way to do this would be? So far I've scrapped a lot of ideas and this is what i have now, though i don't think i can do it this way:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cctype&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  
  using namespace std;
  
  void
  usage(char *progname, string msg){
      cerr &lt;&lt; "Error: " &lt;&lt; msg &lt;&lt; endl;
      cerr &lt;&lt; "Usage is: " &lt;&lt; progname &lt;&lt; " [filename]" &lt;&lt; endl;
      cerr &lt;&lt; " specifying filename reads from that file; no filename reads standard input" &lt;&lt; endl;
  }
  
  int main(int argc, char *argv[])
  {
      string adj;
      string file;
      string line;
      string articles[14] = {"a","A","an","aN","An","AN","the","The","tHe","thE","THe","tHE","ThE","THE"};
      ifstream rfile;
      cin &gt;&gt; adj;
      cin &gt;&gt; file;
      rfile.open(file.c_str());
      if(rfile.fail()){
          cerr &lt;&lt; "Error while attempting to open the file." &lt;&lt; endl;
          return 0;
      }
      while(rfile.good()){
          getline(rfile,line,'\n');
          istringstream iss(line);
          string word;
          while(iss &gt;&gt; word){
              for(int i = 0; i &lt;= 14; i++){
                  if(word == articles[i]){
                      cout &lt;&lt; word + " " &lt;&lt; endl;
                  }else{
                      continue;
                  }
              }
          }
          }
    }
  </code></pre>