Return to Snippet

Revision: 31473
at September 7, 2010 11:28 by darwin_nacionales


Initial Code
/*
 *GreatestNum.cpp
 *This program will display the highest integer from the three numbers entered by the user.
 *@MDPN
 *@09072010
*/
#include <iostream>
using namespace std;

int main()
{
	int int1, int2, int3;

	cout<<"\t\t\t     Highest Number"<<endl
		<<"\t\t\t     --------------"<<endl<<endl;
	cout<<"This program will display the highest integer entered by the user."
		<<endl<<endl<<endl;

	cout<<"Please input 1st integer = ";
	cin>>int1;
	cout<<"Please input 2nd integer = ";
	cin>>int2;
	cout<<"Please input 3rd integer = ";
	cin>>int3;
	cout<<"\n\nThe highest number is ";

	if(int1>int2 && int1>int3)
	{
			cout<<int1;
	}//end if
	else if(int2>int3 && int2>int1)
	{
		cout<<int2;
	}//end else-if
	else
	{
		cout<<int3;
	}//end else
	cout<<"."<<endl<<endl;
	return 0;
}//end main

Initial URL


Initial Description


Initial Title
Greatest Number

Initial Tags


Initial Language
C++