Ask Question
5 September, 21:20

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

+5
Answers (1)
  1. 5 September, 21:27
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers