The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
You may have several data files which can be used by a program, and it would be a shameto have to change your program code every time and have to recompile it just in order torun it on a different data file. In such circumstances, it is better to allow the user to inputthe file name while the program is running. In this part, you will do that.Create a string variable which can hold the file name. Insert statements into your programwhich prompt the user to input a filename, then read from keyboard the name of the datafile. Then add the necessary code to associate the ifstream object with the file whoseCreate a new input file (testdata_2.txt for example). You must do this in a plain texteditor (e.g. TextPad, NotePad, Notepad++, TextEdit, etc.) Run the program and whenprompted, give the name of the new file as the filename. Run it on your old filetestdata.txt also and make sure the program is working well.The user may also be prompted in the same manner for the name of an output file to create.Add code that allow the user to enter the name of the output file. Test your program and make sure everything is working well.
Â
65000.8536548.00100358.65300000.0043200.8986399.0086400.25
Attachments: