html - GML Storing User Input -
so have been working on programme inquire user input values , when user exits code entering -99 suppose homecoming total value of numbers , average i'm stumped values maintain getting overided previous one... here code
{ var user_input;<br> var output_msg;<br> var count;<br> var highest;<br> var value;<br> var total;<br> count = 0; { user_input = get_integer("enter number add together list(enter -99 leave)",-99); if (user_input == (-99)){ continue} count += 1; value = 0; value = value + user_input; average = value/count; } until(user_input == (-99)){ count -=1; user_input = user_input + 99; output_msg=("#numbers entered: " + string(count) + "##total value of numbers: " + string(highest) + "## average:" + string(average));` } show_message(output_msg); }
how create doesn't override previous one?
this because setting value equal 0 every time while loop executed. seek setting
value = 0;
before start until loop. perhaps right after
count = 0;
like this:
count = 0; value = 0; do{ user_input = get_integer("enter number add together list(enter -99 leave)",-99); if (user_input == (-99)){continue} count += 1; value = value + user_input; average = value/count; }
html input storage gml
No comments:
Post a Comment