Question: Create a program that reads in a word from the user and counts the number of occurrences of that word in a file called words.txt.

Create a program that reads in a word from the user and counts the number of occurrences of that word in a file called words.txt.Create a program that reads in a word from the user andcounts the number of occurrences of that word in a file called

The following code inputs a string and then reads a file called code.cpp. It then outputs the number of times the string appears. The issue I'm having is this: when I input the string "many", the code was supposed to output the number "6", but instead it output "4" because it does not count the ones with capital letter (Many and MANY). How do I fix this?

wordoccurrences Micresoft Visusl 2010 Express File Edit Vw Praject Debug Taals windaw Hep selution Lcalorer 0 words.tst wordoccurrences.cpp. X main ordoccurrences.cpp Defines the entry point for the console application Hcoder Filcs | //#include "stdafx.h.. | #include ostream> targetver.h Resource Hiles 1,Sourco Files #includec string> using nanespace std; werdoccurences.cpp ReadMe txt int nain O ifstream file("words.txt) string word; Mordoccurrences.exe Loadec cwNE SySN4kerrel wordoxcurrences.exe urloade C:Wincns SysNO4,kene132.d11 Canrot tind ar open the , char x cininput while (filc >> word) wordoccurrences.ex: Loaded C:windsSysNS4KerrelBase.dll' Cenot find or open th wordoxcurrences.exe Loaded 'C: WIndowS SYSWON64 nsvcr18ed.di1', Synbols loaded wordoccurrances.xoadd C:t ndaws,Sysnsucplaod.d1', Synhals loadar The threac NLn32 Thread. Bs3fge] has exited with code 3 (exD) The threac .NLn32 Thread" 6x2958) has exited with code e (exe) The prneran 153 arcoccurrencas.expNtas exited with cade a (axP) f (inputword) file.close)i cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!