LAB2: bounds-safe W reading

This commit is contained in:
2026-02-25 19:50:23 +03:00
parent c8f7782552
commit a588d8f8d0

View File

@@ -15,8 +15,20 @@ void lab_2()
printf("Enter [W_min]: ");
READ_EXACT("%lf", w_min);
printf("Enter [W_max]: ");
READ_EXACT("%lf", w_max);
do
{
printf("Enter [W_max]: ");
READ_EXACT("%lf", w_max);
if (w_max < w_min)
{
printf("W_max cannot be less than W_min, try again\n");
continue;
}
break;
}
while (1);
printf("Enter [d]: ");
READ_EXACT("%d", d);