Ami project cpp

basically, its a loop but manual u give it 4 number
 avatar
user_2871677978
c_cpp
3 years ago
777 B
7
Indexable
#include<iostream>
using namespace std;
int main()
{
    int a, b, c, d;

    cout << "Please input 4 integers: \n";
    cin >> a >> b >> c >> d;

    if (b < a)
    {   
        int temp = a;
        a = b;
        b = temp;
    }
    if (c < b)
    {
        int temp = b;
        b = c;
        c = temp;
    }
    if (b < a)
    {
        int temp = a;
        a = b;
        b = temp;        
    }
    if (d < c)
    {
        int temp = c;
        c = d;
        d = temp;
    }    
    if (c < b)
    {    
        int temp = b;
        b = c;
        c = temp;
    }
    if (b < a)
    {
        int temp = a;
        a = b;
        b = temp;
    }    
    cout << a << ' ' << b << ' ' << c << ' ' << d;

    return 0;
}
Editor is loading...