Question
Write a C++ program consisting of (a) a function words equal (char w1[ ], char w2[ ], int len). The function returns whether both strings
Write a C++ program consisting of
(a) a function words equal (char w1[ ], char w2[ ], int len).
The function returns whether both strings are exactly equal. The
third parameter int len contains the maximum length of the strings
w1 and w2.
(b) and a main() function:
- Provide memory for an array of 1000 words of 100 letters each.
letters each.
- All words are to be read from a file and stored in the field provided above.
The name of the file is to be read in by the user and has a maximum of
41 letters. If an error occurs in the file work, it is to be
it is assumed that this error occurred due to a wrong input by the user.
by the user. In this case the program must not be
must not be terminated in this case, but must guarantee the reading of the data.
The first value of the file contains the number of words contained in the file
followed by all words.
To solve the task, the use of the library fstream
is allowed.
- Using the function words designed in 1a, find out how often a word entered by the user occurs in the field
occurs. Output the result to the user.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started