// SECJ1013-01 Assignment 1
// Group Members:
// AHMAD ZULHAKIM BIN ZAINAL A19EC0179
// LEE TONG MING             A19EC0069
// Question 1

#include <iostream>
#include <iomanip>
using namespace std;

// Function prototype
void swap(float &first, float &second);

int main()
{
    float first,      // To hold the first floating point number
          second;     // To hold the second floating point number
    
    // Get the two numbers
    cout << "Enter the first number:\n";
    cin >> first;
    cout << "\nEnter the second number:\n";
    cin >> second;
    cout << "\nYou input the numbers as " << first << " and " << second << ".\n";
    
    // Calling function swap.
    swap(first, second);

    // Display the swapped numbers.
    cout << "After swapping, the first number has the value of " << first
         << " which was the value of the second number.\n"
         << "The second number has the value of " << second 
         << " which was the value of the first number.\n";
    system("pause");
    return 0;
}

// Definition of function swap.
// This function swaps the two numbers.
void swap(float &number1, float &number2)
{
    float a;

    a = number2;
    number2 = number1;
    number1 = a;
}