Skip to content

Commit 4bfe0ac

Browse files
committed
[fix] invalid choice
1 parent 7414bcd commit 4bfe0ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/osps.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ int main()
6262
std::cin >> choice;
6363
std::cout << "You have chosen " << scheduling_algo(choice) << std::endl;
6464

65+
if (!(choice >= 1 && choice <= 5))
66+
{
67+
std::cout << "Invalid choice. Exiting..." << std::endl;
68+
return 0;
69+
}
70+
6571
int n;
6672
osps::Process p[100];
6773

0 commit comments

Comments
 (0)