/******************************************************************************

Name        : NOOR HANNANI SYAMIMI BINTI MOHD SUFFIAN
Matric No.  : A21EC0104
Subject     : PROGRAMMING TECHNIQUE
Date        : 06/ 02 /2022
 
*******************************************************************************/
// TOTAL = 15/15

#include <iostream>

using namespace std;

void getRange (int& , int&);
bool detOrder (int , int);
void doAscend (int , int);
void doDescend (int , int);
//Function Protoypes
//COMPLETE THIS (2 Marks)   


//Main function
int main()
{
    //Variables' declaration
    int int1, int2;
    
    //Calling function - Get the input
    getRange(int1, int2);
    
    //Testing the order
    if (detOrder(int1, int2))
	    //Calling function - Ascending order
        doAscend(int1, int2);
    else 
        //Calling function - Descending order
        doDescend(int1, int2);

    return 0;
}

//Function - Get the inputs
void getRange (int& i1, int& i2)
{
    //Getting 1st input
    cout << "Please give 1st integer number (between 0 - 100) :";
    cin >> i1;
    while (i1 < 0 || i1 > 100)
    {
        cout << "Please enter 1st integer number between 0 and 100: ";
        cin >> i1;
    }  
   
    //Getting 2nd input
    cout << "Please give 2nd integer number (between 0 - 100) :";
    cin >> i2;
    while (i2 < 0 || i2 > 100)
    {
        cout << "Please enter 2nd integer number between 0 and 100: ";
        cin >> i2;
    }  
}

//Function - Determine the order
bool detOrder (int i1, int i2)
{
    //COMPLETE THIS (4 Marks)    
   bool a = i1 < i2;
  
  return a;
  
}

//Function - Descending order
void doAscend (int i1, int i2)
{
   //COMPLETE THIS (3 Marks)	
	do
	{
		cout << i1 << " ";
		i1++;
		
	}while (i1 <= i2);
}

//Function - Descending order
void doDescend (int i1, int i2)
{
     //COMPLETE THIS (3 Marks)	
	do 
	{
		cout << i1 << " ";
		i1--;
		
	}while (i1 >= i2);
}








