LAB2: bounds-safe W reading
This commit is contained in:
16
src/LAB2.c
16
src/LAB2.c
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user