Assignment No. 5
Deadline
Your assignment must be uploaded/submitted before or on 15th April 2003
Uploading instructions
Please view the assignment submission process document provided to you by the Virtual University to upload the assignment.
Rules for Marking
It should be clear that your assignment will not get any credit if:
o The assignment is submitted after due date
o The submitted assignment does not compile or run
o The submitted assignment is not in .cpp format
o The assignment is copied
Objective
The objective of this assignment is to provide hands on experience of
Ø File handling mechanism in C
Ø Searching in files
Assignment
Write a program that takes a word from the user and display the number of times it appears in the given file.
o Write a function which checks the valid input.
Valid input means that it will fulfill the following two conditions.
1. At least one character should be entered.
2. No space between the Word.
Your output on the screen should be like:
Enter the word : is
The Word ‘is ‘repeats 3 times in a File.
Do you want to continue (y/n) ……. y
Enter the word : is not
No space allowed please enter the word again
Enter the word : statement
The Word ‘statement ‘repeats 1 times in a File.
Do you want to continue (y/n) …….y
Enter the word : read
The Word ‘read’ does not exist in the File
Do you want to continue (y/n) …….n
Note
Create a folder with a name as “Assignment5” and create a new text file with a name as “Assign5” and copy paste the following paragraph and save it
Paragraph
"It is a sarcastic statement about modern education, and it means that the modern education is not developing critical skills like planning, organizing and paying attention to detail. Practically, in our day to day lives we are constantly planning, organizing and paying attention to fine details if we want our plans to succeed. And it is also fun to do these activities. For example, for a picnic trip we plan where to go, what to wear, what to take for lunch, organize travel details and have a good time while doing so."
Suppose if you create this folder in Drive D:
The path will be “D:\Assignment5\Assign5”.
Your .cpp file and Assign5.txtshould be saved in the same folder.
Read the above specifications and:
a)Write a C program to solve the problem based on your flow-chart
Submit ONLY the .cpp file as your assignment.