V
V
Vlad2422018-09-12 18:45:13
C++ / C#
Vlad242, 2018-09-12 18:45:13

C++ program to calculate the maximum in a,b,c?

Guys, hello everyone!
How to make a program to calculate the maximum in {a,b,c}.
Help please, otherwise it doesn’t work)
(I wanted to do it through if else conditions, but I can’t do it completely)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pavel, 2018-09-13
@Vlad242

#include <algorithm>
#include <vector>
int main()
{
  std::vector<int> abc{1,2,3};
  return *std::max_element(abc.begin(), abc.end());
}

A
Armenian Radio, 2018-09-12
@gbg

std::max(std::max(a,b),c)

A
Alexander Taratin, 2018-09-18
@Taraflex

https://stackoverflow.com/a/43946752

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question