C++ Simple Looping Program Problem

Prompt. Input ints, non-# to quit. ( Output the following 4 values:
smallest #
second-smallest #
second-largest #
largest #
You may assume without checking that the #'s are all distinct.
You may assume without checking that there are at least 2 numbers.

An example run of your program might go as
Type, integers, non-# to quit: 5 2 1 -6 8 blah
smallest: -6
second-smallest: 1
second-largest: 5
largest: 8

I really have no idea how to go about this problem. Is this on that right track? Where should I go from here? Any help would be appreciated.

My code:

#include <iostream>
#include <cmath>
#include <cstdlib>
#include <string>
#include <iomanip>
using namespace std;

bool die(const string & msg);

int main(){
int num;
int max;
int min;
int countNum = 0;
bool seenNumber = false;
cout << "Type integers, non #'s to quit: ";
for (int i; cin >> i;){
if (!seenNumber){
seenNumber = true;
max = i;
}
countNum++;
}
}
bool die(const string & msg){
cout << "Fatal error: " << msg << endl;
exit(EXIT_FAILURE);
}
Please use code tags! (inc. going back an editing you opening post, so anyone who reads this thread in the future can see what's going on better!) And ensure your code is well formatted (indent, spacing, etc.)

"How to use code tags"
http://www.cplusplus.com/articles/jEywvCM9/

;) ;) :) :)
Topic archived. No new replies allowed.