I ma not able to generate code for the following program.can anyone assist me in writing the code
Write a program in C++ that allows the input of names and ages from the key board and stores them , in characters, in a file titled persons.dat. After the input is finished , the program should print out what is in the file as well as the average age.