Psl67/recursion templates

จาก Theory Wiki
รุ่นแก้ไขเมื่อ 02:09, 10 กุมภาพันธ์ 2568 โดย Jittat (คุย | มีส่วนร่วม) (สร้างหน้าด้วย "== findmax == <syntaxhighlight lang="cpp"> #include <iostream> #include <vector> using namespace std; int n; vector<int> x; void read_input() { cin...")
(ต่าง) ←รุ่นแก้ไขก่อนหน้า | รุ่นแก้ไขล่าสุด (ต่าง) | รุ่นแก้ไขถัดไป→ (ต่าง)
ไปยังการนำทาง ไปยังการค้นหา

findmax

#include <iostream>
#include <vector>

using namespace std;

int n;
vector<int> x;

void read_input()
{
  cin >> n;
  for(int i = 0; i < n; i++) {
    int xx;
    cin >> xx;
    x.push_back(xx);
  }
}

int find_max(vector<int>& x, int n)
{
  // TODO: write this function, do not use any loop control
}

int main()
{
  read_input();
  cout << find_max(x,n) << endl;
}