Words containing "the" substring: Difference between revisions

Add C++
(Add C)
(Add C++)
Line 452:
}
fclose(f);
return 0;
}</lang>
{{out}}
<pre style="height:50ex;">authenticate
chemotherapy
chrysanthemum
clothesbrush
clotheshorse
eratosthenes
featherbedding
featherbrain
featherweight
gaithersburg
hydrothermal
lighthearted
mathematician
neurasthenic
nevertheless
northeastern
northernmost
otherworldly
parasympathetic
physiotherapist
physiotherapy
psychotherapeutic
psychotherapist
psychotherapy
radiotherapy
southeastern
southernmost
theoretician
weatherbeaten
weatherproof
weatherstrip
weatherstripping</pre>
 
=={{header|C++}}==
<lang cpp>#include <iostream>
#include <fstream>
 
int main() {
std::string word;
std::ifstream file("unixdict.txt");
if (!file) {
std::cerr << "Cannot open unixdict.txt" << std::endl;
return -1;
}
while (file >> word) {
if (word.length() > 11 && word.find("the") != std::string::npos)
std::cout << word << std::endl;
}
return 0;
}</lang>
2,114

edits