I have an assignment due tonight that needs to at least function. The assignment is to create a txt file and write a sentence in it. From there, the program needs to display this sentence from the file and then find how many of a letter is used (basically an array). An example would be "There is a green car in the driveway." So if I put the letter 'g' in the query, the program would say "There is 1 'g'."
The main issue I'm having is trying to get a program to both create a file, write something in it, then read its contents. I looked at the tutorials on the main page but they are not as clear cut as I hoped they were.
Line 24, you declare an ifstream with the same name as an existing variable. If you use a different name it could possibly work. Remember to close the file before trying to open the same file for input.