Ask Question
15 October, 13:44

Write a programme with C + + language wich print the biggest number in between three numbers, whith INT

+4
Answers (1)
  1. 15 October, 16:49
    0
    Your question is a bit misleading, I'm having trouble understanding what you mean with "in between". I'm assuming you want the biggest number from an input of 3 numbers. You did not specify what should happen if more than one number is the biggest (ie., they're equal).

    A very naive implementation might be:

    void PrintBiggest (int a, int b, int c)

    {

    if ((a > = b) && (a > = c)) cout << a;

    else if ((b > = a) && (b > = c)) cout << b;

    else if ((c > = a) && (c > = b)) cout << c;

    }

    If you want to use STL (mine is a little rusty), the following could be the start of something more generic:

    void PrintBiggest (int a, int b, int c)

    {

    std::vector myints;

    myints. push_back (a);

    myints. push_back (b);

    myints. push_back (c);

    sort (myints. begin (), myints. end ());

    cout << myints. back ();

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a programme with C + + language wich print the biggest number in between three numbers, whith INT ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers