Monday, August 31, 2015

Low and High Number Checker Using Two Dimensional Array in C++

In this program it will ask the use to enter two numbers and then the program will compare and determine which to the two number is the higher and the lowest in terms of value using two dimensional array in C++.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.


Sample Program Output

Program Listing


#include <iostream>

using namespace std;

void display(void)
{
 int high=0,low=0;

int val[2][1];

cout << "\t Low and High Number Checker 1.0";
cout << "\n\n";
cout << "Enter two numbers :=> ";
cin >> val[0][0] >> val[1][0];

 if (val[0][0] > val[1][0]){
     high = val[0][0];
     low = val[1][0];
 }
    else if (val[1][0] > val[0][0] ){
     high = val[1][0];
     low = val[0][0];
 }
 else if (val[1][0] == val[0][0])
 {
     cout << "\n\n";
     cout << "They have the same value. Try Again";
 }
 cout << "\n=======================";
 cout << "\n   Display Result      ";
 cout << "\n=======================";
 cout << "\n\n";
 cout << "\n Highest Number ==> " << high << ".";
 cout << "\n Lowest  Number ==> " << low <<  ".";
 cout << "\n\n";
 system("pause");
}

main()
{
 display();
}


No comments:

Post a Comment