The Needle in the Haystack (WSQ12)

Photograph credit

This program was really hard to make. I think that is because we have never worked with something other than the monitor to run our programs. Now we had to involve a text file. I started this program on friday and all I have been doing is this, I finally finished and I want  to help you guys so it doesn’t take you so long. I think I easily read like 6 webpages, checked in 4 books and watched 7 youtube videos to find out how to do this program. That was the thing that consumed most of my time.

I’m gonna save your time and tell you the information that was helpful. My tutorial is divided in three sections: the first is just an introduction, the second is how to find a word in a string and the third is how to find the word in a whole text file. First you need to know how to open, close, input and output to a file. for that check out this page. Then you need to know how to work with strings to find a word in it. And the rest is to use your brain for the logic of the program. I looked in so many places really, but there was one book that had THE ANSWERS TO ALL MY PROBLEMS, I wish I had looked there in the first place. AND WHERE IS THIS BOOK?! Well.. believe it or not, it’s the book for our course. Yeah I know, who would have known. This is the first time I look at it. In my tutorial I explain how to get it but you can just press this link and download the PDF.

As usual here is my code:

WordCountText.cpp

WordCountString.cpp

And here are the

videos. I recommend you watch them in order but it’s your choice.

Made by Orlando Lara

CC BY-SA 4.0 The Needle in the Haystack (WSQ12) by Orlando Lara is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.