Read & Write
Create a file using ofstream
and write a sequence of numbers (separated by a space), a newline, and a string. Then open that same file using ifstream
, and read the file’s contents into appropriate variables. Print the variables’ values to ensure you have read from the file successfully. Clear the file when you are done with it.
- Previous
- Next