/******************************************************************
 Program:  functions.C
 This program computes the square and cube of an integer value
******************************************************************/
#include <iostream.h>

int Square( int ); //FUNCTION
int Cube( int );   //DECLARATIONS

int main()
{
    int x;
    cout << "Enter an integer value: ";
    cin >> x;
    cout << "The square of " << x << "is " << Square(x)  << endl;
    cout << "and the cube of " << x << "is " << Cube(x) << endl;
    return 0;
}

int Square( int n ) //FUNCTION HEADER
{
    return (n*n); //RETURNED INTEGER VALUE
}

int Cube( int n ) //FUNCTION HEADER

{
    return (n*n*n); //RETURNED INTEGER VALUE
}



Back to Previous Page

Document:
Local Date:
Last Modified On: