C++: Infinite loop with a simple menu selection

The script I am working on is over a page long, so I am going to link it (one simple file): http://pastebin.com/7BVHmQGp

I apologize for that. My problem is I get into an infinite loop in my code, for example after I select 1 or 2 for encrypting/unencrypting it lets me enter the word, and when I next enter the "shift" for the cipher it runs an infinite loop of the menu.

I had tried for so many hours to debug this, I thought it was a problem with cin, for example when you enter an invalid choice it just throws an infinite loop/

What seems to cause the infininte loops?


I think you should be ignoring the newline character instead of a space

I tried with the following and it works on VS2010

    cin.ignore(1, '\n');
    getline(cin, input);

Need Your Help

C# SQLite and SQL commands Specified cast not valid

c# sqlite sqlcommand

I'm playing around with SQlite and sql commands. I'm trying to make a quizz program and I have a loop, that reads the questions and answers from my database and adds them to a list. I also have a b...

How to access external .config files?

c# asp.net-mvc web-config appsettings

I have an asp.net mvc website which of course has a web.config file. I also have an external project which is a class library that uses a .config file for its own app settings. The problem is when ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.