[c++] Program to find largest and smallest among 5 numbers without using array

You can do something like this:

int min_num = INT_MAX;  //  2^31-1
int max_num = INT_MIN;  // -2^31
int input;
while (!std::cin.eof()) {
    std::cin >> input;
    min_num = min(input, min_num);
    max_num = max(input, max_num);
}
cout << "min: " << min_num; 
cout << "max: " << max_num;

This reads numbers from standard input until eof (it does not care how many you have - 5 or 1,000,000).