All pastes #918284 Raw Edit

Untitled

public text v1 · immutable
#918284 ·published 2008-02-26 00:57 UTC
rendered paste body
#include <iostream>
using namespace std;

int main ()
{

	int number, choice, input, greatest, smallest;
cout<< "How many elements are there in the problem? \n";
cin>> number;
cout<< "What would you like to know \n";
cout<<"For the greatest number enter 1 \n";
cout<< "For the lowerst number enter 2 \n";
cout<< "For both enter 3 \n";
cin>> choice;
cout<< "Enter a number";
cin >> input;

smallest = input;
greatest = input;
for (int counter =0; counter <= number; counter++)
{
	cout<< "Enter a number";
	cin>> input;
	if (input < smallest)
	smallest = input;
	if (input > greatest)
	greatest = input;

}

		switch (choice)
	{
		case 1:
			cout<< smallest << "is the smallest number"; 
			break;
		case 2:
			cout<< greatest << "is the greatest number";
			break;
		case 3:
			cout<< smallest << "is the smallest number"<< " and "<< greatest << " is the greatest number";
			break;
		}

		system("pause");



return 0;
}