Problem Statement: Write a C++ program to create a file “mydata.txt”, accept the name and age of 10 persons from the console and add them to the file (each record must be on a new line). Read the contents of the file back in two variables (name and age) and display them on the console.
Use following ways to read & write data and identify the difference:
1. Extraction & insertion operators
2. get() & put() functions of stream classes
Note:- Scroll horizontally to see the full line of code.
Comments
Post a Comment