The way you wrote the code, it always returns to the menu. Remove the loop and it won't return to the menu.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
What's a loop? What does a loop do when it reaches the end of the loop? How does the loop stop?
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
As has been discussed in many other threads here, "cin >>" doesn't remove the end-of-line from the stream after you read in the zero or one. So I'm thinking the getline() at line 21 gets the now-empty line and writes it to the file, rather than waiting for a new line of input.
Instead of cin >> n1; at line 16, try:
#include <sstream>
...
string line;
getline(cin, line);
istringstream is_strm(line);
is_strm >> n1;
raptr_dflo
Practically a Master Poster
602 posts since Aug 2010
Reputation Points: 76
Solved Threads: 82
Naveen12,
Please do not add questions to solved threads. Instead, create a new thread, re-posting your code with any specific questions. Thanks!
raptr_dflo
Practically a Master Poster
602 posts since Aug 2010
Reputation Points: 76
Solved Threads: 82