|
| 1 | +⭐⭐⭐⭐⭐⭐⭐ WEB WITH AMAN ⭐⭐⭐⭐⭐⭐⭐ |
| 2 | + |
| 3 | +🟢 Language ➡ C++ |
| 4 | +🟢 Topic ➡ File Handling |
| 5 | + |
| 6 | + |
| 7 | +01. Write a C++ program to create a file and print “File created successfully” and throw an error if file is not created. |
| 8 | + |
| 9 | +02. Write a C++ program to read a text file and count the number of characters in it. |
| 10 | + |
| 11 | +03. Write a C++ program to open an output file 'a.txt' and append data to it. |
| 12 | + |
| 13 | +04. Write a program to copy the contents of one text file to another while changing the case of every alphabet. |
| 14 | + |
| 15 | +05. Write a C++ program to merge the two files. |
| 16 | + |
| 17 | +06. Write a C++ program that counts the total number of characters, words and lines in the file. |
| 18 | + |
| 19 | +07. There are 50 records in a file. Each record contains 6-character item-code, 20 |
| 20 | +characters for item-name and an integer price. Write a program to read these |
| 21 | +records, arrange them in the descending order of price and write them in the same |
| 22 | +file, overwriting the earlier records. |
| 23 | + |
| 24 | +08. A file 'Employee.txt' contains empno and empname. Write a C++ program to add and |
| 25 | +read contents of this file and search for an employee whose name is 'XYZ'. |
| 26 | + |
| 27 | +09. A company has following details of their employees in the file 'emp.dat' |
| 28 | +a. Emp Id |
| 29 | +b. Emp Name |
| 30 | +c. Emp Address |
| 31 | +d. Emp Dept (Admin/Sales/Production/IT) |
| 32 | +e. Emp Phone |
| 33 | +f. Emp Age |
| 34 | +Write a C++ program to read the above file. Create a new file such as Adm.dat, |
| 35 | +Sal.dat, Pro.dat, IT.dat respectively to store the employee details according to their department. |
| 36 | + |
| 37 | +10. Write a C++ program to create a file which has information Name, Account number, |
| 38 | +Balance and perform following operations: |
| 39 | +a. Add record |
| 40 | +b. Display content of file |
| 41 | +c. Display name of person having balance > 10,000 |
0 commit comments