Assignment 9
Assignment 9
1. Write a program to read eid, name and salary of 10 employees from keyboard and write them
into a file “emp.doc”
2. What is stream? Explain the different stream classes used in C++ for input and output with their
uses.
3. What are the different operations that can be performed on files? Describe each of the
operations with proper example.
4. How binary files are different from character files? Compare and contrast between them with
their strength and drawbacks.
5. Write a program to write records of 5 items in file ‘item.dat’. Item class should contain data
members code and price.
6. What is meant by random access to files? Describe the different functions that support random
access files.
7. Write a program to read first, third and fifth record from the file “item.dat” and display them on
monitor.
8. Write a program to calculate numbers of objects in a file
9. Write a program that reads contents of one file and writes to another file
10. Write a program that reads 1000 numbers from keyboard and write these numbers to different
files. If the number is even then write it to file “even.dat” and write to file “odd.dat” otherwise