Explanation of Solution
Syntax error:
An error which occurred on the source code of a program is referred as “syntax error”; because the computer programs strictly follows the syntax rules, if the code fails to prove its language syntax format then the compiler will throw an error.
Purpose of the given code:
The purpose of the given code is to open the file “info.dat” using “fstream” file stream object.
List of errors present in the given code:
The code that is given contains some of the syntax error and it is listed as follows:
Error 1:
- The file open statement is an error in the given code.
- In C++, files can be opened using file stream object definition. In definition, the open statement contains two arguments such as file name and file access mode.
- The format for including the file access mode in file open statement as follow as:
- ios::in
- The scope resolution operator “::” is missing in the given file open statement.
Therefore, the given file open statement is modified as:
fstream dataFile(“info.dat”, ios::in);
Error 2:
- The “get()” function cannot be used to read the string value...
Want to see the full answer?
Check out a sample textbook solutionChapter 12 Solutions
Mylab Programming With Pearson Etext -- Access Card -- For Starting Out With C++: From Control Structures Through Objects, Brief Version
- The program, word_frequency, counts the number of occurrences of words in a document. The program takes a filename as a parameter and performs the task. Get the program to run using the attached text file called document.txt. The file contains a piece of text. After you run the program and understand it's logic, modify word_frequency.py to use a binary search tree instead of a dictionary. Tasks: 1. Import a binary search tree 2. Change the filename in the program to reflect the change(s) made Python Only and no other coding languages. Import the module first before running it. Please show output when done. (build off of this file and try not to change too much) word_frequency.py: import sysfilename = sys.argv[1] freq = {}for piece in open(filename).read().lower().split():# only consider alphabetic characters within this pieceword = ''.join(c for c in piece if c.isalpha())if word: # require at least one alphabetic character freq[word] = 1 +…arrow_forwardFile Analysis USING PYTHON- DICTIONARY NOTE FIND ATTACHED BELOW 2 FILES THA SHOULD BE USED FOR THIS ASSIGNMENT Using python, Write a program that reads the contents of two text files and compares them in the followingways:It should display a list of all the unique words contained in both files.It should display a list of the words that appear in both files.It should display a list of the words that appear in the first file but not the second.It should display a list of the words that appear in the second file but not the first.It should display a list of the words that appear in either the first or second file, but notboth.Hint: Use set operations to perform these analyses. ATTACHED FILES first FILENAME: first_file.txt The quick brown fox jumps over the lazy dog. Second FILENAME: second_file.txt Jack be nimble, Jack be quick, Jack jump over the candlestick. . For the program, you need to write: Comments for all the values, constants, and functions IPO Variables Pseudocodearrow_forwardA Ring, refers to a record chain, the last of which refers to the first record, in the chain, is called a pointer wxplain?arrow_forward
- def read_flights(flights_source: TextIO, routes: RouteDict) -> FlightDir: """Return the flights from flights_source, including only the ones that have an entry in routes. >>> from io import StringIO >>> flight_src = StringIO(TEST_FLIGHTS_SRC) >>> actual = read_flights(flight_src, TEST_ROUTES_DICT_FOUR_CITIES) >>> actual == TEST_FLIGHTS_DIR_FOUR_CITIES True """ flights = [] src_index = FLIGHT_DATA_INDEXES["Source airport"] dst_index = FLIGHT_DATA_INDEXES["Destination airport"] # Complete this function. for line in routes_source:arrow_forwardID numbers of students receiving scholarships from the governorship and students receiving scholarships from themunicipality in a province are kept in two separate files (“governer.txt“ and “municipal.txt”). Write a program that comparesthese two files, identifies students who receive scholarships from both institutions at the same time, and saves their namesand surnames in the "common.txt" filearrow_forwardThe program, word_frequency, counts the number of occurrences of words in a document. The program takes a filename as a parameter and performs the task. Get the program to run using the attached text file called sonet18.txt. The file contains William Shakespeare sonet18. After you run the program and understand it's logic, modify word_frequency.py to use a binary search tree instead of a dictionary. Tasks: 1. Import a binary search tree 2. Change the filename in the program to reflect the change(s) made Python Only and no other coding languages. Import the module first before running it. Please show output when done. word_frequency.py: import sysfilename = sys.argv[1] freq = {}for piece in open(filename).read().lower().split():# only consider alphabetic characters within this pieceword = ''.join(c for c in piece if c.isalpha())if word: # require at least one alphabetic character freq[word] = 1 + freq.get(word, 0) max_word = ''max_count = 0for (w,c) in…arrow_forward
- Program in C language the creation of a vector of n=5 records, each record made up of the following fields: ProductName, Quantity, Price, Include the following functions:.a) vector reading.b) Screen printing.c) Save the Vector to a file.d) Read the vector from a file.e) main().arrow_forwardhow to write a function that calls a list of files and organizes them by the assigned numeric order to them and then returns said list in order of when they were createdarrow_forwardA data dictionary is a particular kind of file that includes information about?arrow_forward
- #include "Bank.h" #include <iostream>#include <fstream>#include <string>#include <vector> using namespace std; int main() { Account** accounts = new Account * [10]; ifstream infile; infile.open("bank2.txt"); if ( !infile ) cerr << "File cannot be opened" << endl; else cout << "File Opened" << endl; string operationType; int totalAccount = 0; while (infile >> operationType) { if (operationType == "Saving") { int id; double initialBalance, minimumBalance, annualInterestRate; infile >> id >> initialBalance >> minimumBalance >> annualInterestRate; Saving* savingAccount = new Saving(); savingAccount->setInterest(annualInterestRate); savingAccount->setMinBalance(minimumBalance); accounts[totalAccount] = savingAccount; accounts[totalAccount]->setID(id);…arrow_forwardIn Unix You have a record structured file named mydata that has four columns with default delimiter (white space). Sort the file based on its second column and redirect the file to a new file called sortedData.arrow_forwardCreate a code for the bank transaction record using linked list.arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage