Write a main function that opens an ifstream on the input file, "person.dat". If the stream cannot be opened, output an error message and exit. The file format is as follows:
last_name comma first_name comma weight newline
Hello, I’ve been trying so manyfunction for this but those function didn’t work. Please write the function for this probelm.