Searching a file, line by line, to find an exact copy of a string array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Searching a file, line by line, to find an exact copy of a string array

I have a string array of Morse code from a to z, and 0 to 9. The user types a phrase and it converts it to Morse code, then I have to see if that exact copy of the phrase is in the file.

16th Jan 2017, 4:35 AM
Brandon Skar
Brandon Skar - avatar
3 Answers
+ 3
What language are you doing this in?
16th Jan 2017, 4:38 AM
Alex
Alex - avatar
+ 3
For c++ you can do something like this using Use ifstream to read data from a file: std::ifstream input( "filename.ext" ) then do a loop like so for( std::string line; getline( input, line ); ) { ...for each line in input... }
16th Jan 2017, 4:43 AM
Alex
Alex - avatar
0
oh. c++, new to this
16th Jan 2017, 4:39 AM
Brandon Skar
Brandon Skar - avatar