a1695662252 发表于 2019-10-27 15:40:15

伪代码写的,求编写全过程,大神求解!!

        int n;
        n = 1;
        input max;
        while n<10 do:
                input a
                if a>ma)
                then max=a;
                n = n + 1;
        end do
        print max;
               

a1695662252 发表于 2019-10-27 15:41:26

补充:依次将10个数输入,要求将其中最大的数输出。

zwh1481017739 发表于 2019-10-27 17:18:06

去python问呀,你这个好像是python吧

bin554385863 发表于 2019-10-27 18:36:56

本帖最后由 bin554385863 于 2019-10-27 18:39 编辑

#include <iostream>
#include <array>
int main(int argc, char const *argv[])
{
      int _max = 0;
      std::array<int, 10> _arr = {0};
      std::cout << "请输入10个数字" << std::endl;
      for (int i : _arr)
      {
                std::cin >> i;
                _max = _max > i ? _max : i;
      }
      std::cout << "你输入的10个数字最大值是: " << _max;
      return 0;
}

--------------------------------------------------------------------------------------
Microsoft Windows [版本 10.0.16299.1087]
(c) 2017 Microsoft Corporation。保留所有权利。

E:\Users\86184\Documents\Code>c:\Users\86184\.vscode\extensions\ms-vscode.cpptools-0.26.0\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-tafqzzw3.um4 --stdout=Microsoft-MIEngine-Out-0tzu0v4h.yrl --stderr=Microsoft-MIEngine-Error-ocurmzpg.lcc --pid=Microsoft-MIEngine-Pid-4hh2zyxr.tjr "--dbgExe=E:\My Program\MinGW\bin\gdb.exe" --interpreter=mi
请输入10个数字
65 32 41 963 5 2 3 0 85 123
你输入的10个数字最大值是: 963
E:\Users\86184\Documents\Code>

AmosAlbert 发表于 2019-11-1 21:44:52

遍历数组打擂台
页: [1]
查看完整版本: 伪代码写的,求编写全过程,大神求解!!