Hello again
Trying to find a method that when prompted to enter a value, the user presses the 'Enter' key for the program to accept a default value. Apparently there is not a consistent ascii code of 'Enter' that I can use to compare, if I understand it correctly. Here is a snippet of my example. I used the highlight option this time- not sure if correctly.
btw, the code, in entirety, works. Thanks.
Edit- I don't see anything highlighted
[CODE title="Snippet" highlight="1-21"]
int h, temp, response = 0;
int local_press = 760;
printf("\n1\tAtmospheric pressure known (mmHg) <760>\n");
printf("2\tAltitude and air temperature known\n");
printf("\nPlease enter a choice (1 or 2): ");
response = get_user_input();
if (response == 1 )
{
printf("\n Enter Atmospheric Pressure [mmHg] <760>");
local_press = get_user_input();
}
else
{
printf("\n Enter Altitude [Meters]:");
h = get_user_input();
printf("\n Enter Air Temperature [Celcius]: ");
temp = get_user_input();
local_press = calc_atm_press(h, temp);
}
[/CODE]
Trying to find a method that when prompted to enter a value, the user presses the 'Enter' key for the program to accept a default value. Apparently there is not a consistent ascii code of 'Enter' that I can use to compare, if I understand it correctly. Here is a snippet of my example. I used the highlight option this time- not sure if correctly.
btw, the code, in entirety, works. Thanks.
Edit- I don't see anything highlighted
[CODE title="Snippet" highlight="1-21"]
int h, temp, response = 0;
int local_press = 760;
printf("\n1\tAtmospheric pressure known (mmHg) <760>\n");
printf("2\tAltitude and air temperature known\n");
printf("\nPlease enter a choice (1 or 2): ");
response = get_user_input();
if (response == 1 )
{
printf("\n Enter Atmospheric Pressure [mmHg] <760>");
local_press = get_user_input();
}
else
{
printf("\n Enter Altitude [Meters]:");
h = get_user_input();
printf("\n Enter Air Temperature [Celcius]: ");
temp = get_user_input();
local_press = calc_atm_press(h, temp);
}
[/CODE]