Question: Read nameOffile and three strings from input. Open nameOffile as an output fle. If the file fails to open, use cout to output nameOffile followed

Read nameOffile and three strings from input. Open nameOffile as an output fle. If the file fails to open, use cout to output nameOffile followed by ". error occurred while opening file,", and do not proceed to the code that writes to the file, Otherwise, for each string read, write "-followed by the string to the opened file. End each output with a newline and close the file. Ex: If the input is output. txt Rabia Dan Asha, then output txt contains: - Rabia - Dan - Asha - Rabia - Dan - Asha using namespoce sta; int main( ) ofstream guest NamesFS; string name0ffile
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
