Help me!!

hello help me plz i'm a beginner, i don't know how to do this

1.Input value to array 2 element
2.Compare between two element then output the maximum number
3.Compare between three element then output the maximum and minimum number
4.Mapping the value of between two element
Ex: a[0] = 10; a[1]=20 -> a[0]=20; a[1]=10
5.Mapping the value of between three element

1
2
3
4
5
6
7
#include <algorithm>
#include <iostream>
#include <utility>

int main()
{
    int elements[3] = {10, 20, 30};

1) std::cin >> elements[2];// Cannot think about anything fancy here
2) std::cout << std::max(elements[0], elements[1]) << std::endl;
3)
1
2
auto x = std::minmax_element(elements, elements + 3);
std::cout << "min = " << *(x.first) << ", max = " << *(x.second);

4) std::swap(elements[0], elements[1]);
5) ??? What do you want here?
Topic archived. No new replies allowed.