certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] applications/HLA_TestsSuite Interactive_Federat...


From: CERTI CVS commits
Subject: [certi-cvs] applications/HLA_TestsSuite Interactive_Federat...
Date: Wed, 01 Feb 2012 16:58:34 +0000

CVSROOT:        /sources/certi
Module name:    applications
Changes by:     Eric NOULARD <erk>      12/02/01 16:58:34

Modified files:
        HLA_TestsSuite : Interactive_Federate1516.cc 

Log message:
        Fix cin error handling

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/Interactive_Federate1516.cc?cvsroot=certi&r1=1.4&r2=1.5

Patches:
Index: Interactive_Federate1516.cc
===================================================================
RCS file: 
/sources/certi/applications/HLA_TestsSuite/Interactive_Federate1516.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Interactive_Federate1516.cc 1 Feb 2012 16:28:05 -0000       1.4
+++ Interactive_Federate1516.cc 1 Feb 2012 16:58:34 -0000       1.5
@@ -278,7 +278,11 @@
                cout <<"\t4- Object Management"<< endl;
                cout <<"\t5- Time Management\n"<< endl;
                cout <<"votre choix : ";
-               cin >> choix;
+               if (!(cin >> choix)) {
+                   cin.clear();
+                   cin.ignore();
+                   choix = 10;
+               }
                cout <<"\n\n-------------------------------------\n";
 
                switch (choix)
@@ -338,6 +342,7 @@
 
                default :
                        cout <<"\tEntrée invalide\n"<< endl;
+                       break;
 
 
                }//fin switch



reply via email to

[Prev in Thread] Current Thread [Next in Thread]