Loops 游戏制作者语言-循环

Loops 游戏制作者语言-循环,loops,gml,Loops,Gml,我一直在编写一个程序,该程序应该循环并显示13次。这是我的密码 { var count; var user_Input; var output_msg; var cel; count = 0; do { user_Input = get_integer("Temperature conversion",""); count = count + 1; cel = user_Input * 9/5 +32;

我一直在编写一个程序,该程序应该循环并显示13次。这是我的密码

 { 
var count; 
var user_Input;
var output_msg;
var cel;
count = 0;

   do 
      { 
        user_Input = get_integer("Temperature conversion","");
        count = count + 1;
        cel = user_Input * 9/5 +32;
        user_Input = user_Input +10;
        output_msg =(string(count) + "Celsius" + string(user_Input) + " = Farenheit " + string(cel));
        show_message(output_msg);
        } 
         until (count == 13)

 }
它所做的是每次我按enter键时显示循环,而不是一次显示所有13个,如果我输入10,例如每次循环时,它都假设从最后一个循环中添加10

例1。摄氏10度=Farenheit(在这里回答)
..... 2.摄氏20度=Farenheit(在这里回答)

......13. Celsuis 130=Farenheit”“
如果有人能带我走过并帮助我,那就太好了

你需要做的是:

  • 将对话框
    show_message
    移动到循环之外,然后在
    Do
    循环之后精确地移动。然后,它将仅在循环结束时显示,而
    get\u integer
    对话框当然将等待用户输入值
  • get_integer
    也移到循环的正前方。用户只需输入一次值。如果你把它放在循环中,你会被要求输入一个值13次
  • 将生成的计算结果附加到要显示的消息(包含在
    输出消息
    本身)中,并在末尾添加换行符
    “#”

  • 为了清楚起见,我初始化了一些变量的初始值


    您的问题不是代码问题,而是逻辑问题(换行除外)。循环中的所有内容(Do,While)都将在每次迭代中执行。如果不希望执行某些操作,则必须将其移出循环(之前/之后),或使用条件检查。

    移动
    user\u Input=get\u integer(…)循环外的行
    
    {
        var count = 0;
        var user_Input;
        var output_msg = "";
        var cel;
        count = 0;
    
        user_Input = get_integer("Temperature conversion","");
        do
            {
            count = count + 1;
            cel = user_Input * 9 / 5 + 32;
            user_Input = user_Input + 10;
            output_msg = (output_msg + string(count) + ". Celsius" + string(user_Input) + " = Farenheit " + string(cel) + "#");
            }
        until (count == 13)
        show_message(output_msg);
    }