From 4bfe0accbbd97793d56e22235cfa2b1e8999a025 Mon Sep 17 00:00:00 2001 From: Divyanshu Shekhar Date: Wed, 26 Jan 2022 11:38:56 +0530 Subject: [PATCH] [fix] invalid choice --- src/osps.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osps.cpp b/src/osps.cpp index c2a2b68..f63a1b1 100644 --- a/src/osps.cpp +++ b/src/osps.cpp @@ -62,6 +62,12 @@ int main() std::cin >> choice; std::cout << "You have chosen " << scheduling_algo(choice) << std::endl; + if (!(choice >= 1 && choice <= 5)) + { + std::cout << "Invalid choice. Exiting..." << std::endl; + return 0; + } + int n; osps::Process p[100];