0% found this document useful (0 votes)
87 views1 page

File Handling - Text File (SET - 1)

The document contains 7 questions about performing various file handling operations in C++ with text files. The questions cover writing numbers and strings to files, reading from files, counting alphabets, blanks, words, and a specific word in files, and copying text from one file to another converting it to uppercase.

Uploaded by

Junaid Arshad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views1 page

File Handling - Text File (SET - 1)

The document contains 7 questions about performing various file handling operations in C++ with text files. The questions cover writing numbers and strings to files, reading from files, counting alphabets, blanks, words, and a specific word in files, and copying text from one file to another converting it to uppercase.

Uploaded by

Junaid Arshad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

FILE HANDLING - TEXT FILE

[SET 1]

Question 1 Write a C++ program to write number 1 to 100 in a data file NOTES.TXT.

Question 2 Write a C++ program, which initializes a string variable to the content "Time is a great
teacher but unfortunately it kills all its pupils. Berlioz" and outputs the string to the disk
file OUT.TXT. you have to include all the header files if required.

Question 3 Write a user-defined function in C++ to read the content from a text file OUT.TXT, count
and display the number of alphabets present in it.

Question 4 Write a function to count the number of blank present in a text file named "OUT.TXT".

Question 5 Write a function to count number of words in a text file named "OUT.TXT".

Question 6 Write a function in C++ to print the count of word the as an independent word in a text
file STORY.TXT.
for example, if the content of the file STORY.TXT is
There was a monkey in the zoo. The monkey was very naughty.

Then the ouput of the program should be 2.

Question 7 Assuming that a text file named FIRST.TXT contains some text written into it, write a
function named copyupper(), that reads the file FIRST.TXT and creates a new file named
SECOND.TXT contains all words from the file FIRST.TXT in uppercase.

You might also like