Question: C + + String nameOfFile and integer onionCount are read from input. Open nameOfFile as an output file. If the file fails to open: Use
C String nameOfFile and integer onionCount are read from input. Open nameOfFile as an output file. If the file fails to open:
Use cout to output nameOfFile followed by : fileopen operation failure" and a newline.
Terminate the program with as the return value without writing to the file.
Otherwise, write onionCount followed by onions" and a newline to the opened file.
Ex: If the input is note.txt then note.txt contains:
onions
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
