C ++: infinite loop with simple menu selection

script I'm working on a page, so I'm going to link it (one simple file):
http://pastebin.com/7BVHmQGp

I apologize for that. My problem is that I end up in an endless loop in my code, for example, after I select 1 or 2 for encryption / decryption, it allows me to enter a word, and when I enter the “shift” for encryption, it launches an endless menu loop.

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

What seems to cause endless loops?

0
source share
3 answers

,

: VS2010

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

cin.clear, , .

    cin >> selection;
    cin.clear(); 
0

This page should explain everything you need to know.

0
source

All Articles