All of the work in this project is my own!  I have not left copies of my code in public folders on university computers. I have not given any of this project to others. I will not give any portion of this project to others taking this class. I realize that the penalty for turning in work that is not my own can range from an "F" in the class to dismissal from Trinity University. 

                                                                                             Print Name  __________________________

                                                                                              Signature   __________________________

                                                                                             Print Name  __________________________

                                                                                              Signature   __________________________
 


Explicit Functions Fact
Team / Individual (1-2 Persons) Assignment
15 Points


Set Netscape Margins [ Left = 1; Right = .2; Top = .6; Bottom = .6; Select Document Title, Location,  Page Number, Page Total Black Text l]


1]  Create  program  ExplicitFunctions.cpp. Copy in the following main program to start. Notice that Functions Fact is incomplete and Fib is missing. Review Explicity Functions Cube and Square.
 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                            Program FactFib.cpp                               // 
//                                                                              // 
// Purpose : Demonstrate Functions with Explicit Returns.                       // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 

///////////////////////////////////  Includes ////////////////////////////////////
# include <iostream.h>

/////////////////////////////////  Prototypes ////////////////////////////////////

long int Square (long int No);
long int Cube (long int No);
long int Fact (long int No);

long int Max (long int No1, long int No2, long int No3 );
long int Min (long int No1, long int No2, long int No3 );
char FirstInAlphabet (char Ch1, char Ch2);
bool EqualChar (char Ch1, char Ch2);
bool Even (long int No);
bool Odd (long int No);

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                    main                                      // 
//                                                                              // 
// Purpose : Repeatedly evoke/call the functions prototyped above.              // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
main(int argc, char * argv[])
{
int 
   No,
   Counter;

   cout << "############################### Start of Main #####################\n";
   cout << "                       Explicit Function Practice\n";
   cout << "                                 written by\n";
   cout << "                                   ????\n\n";

   for (Counter = 1; Counter <= 10; Counter ++)
      cout << "Square (" << Counter << ") = " << Square(Counter) << endl;
   cout << endl << endl << endl;

   for (Counter = 1; Counter <= 10; Counter ++)
     cout << "Cube (" << Counter << ") = " << Cube (Counter) << endl;
   cout << endl << endl << endl;

   for (Counter = 1; Counter <= 10; Counter ++)
   {
      No = Fact (Counter);
      cout << "Fact (" << Counter << ") = " << No << endl;
   }
   cout << endl << endl << endl;

   cout << "Max (2,5,1)     = " << Max (2,5,1) << endl;
   cout << "Max (-12,-5,-1) = " << Max (-12,-5,-1) << endl;
   cout << "Max (15,-5,8)   = " << Max (15,-5,8) << endl << endl;

   cout << "Min (2,5,1)     = " << Min (2,5,1) << endl;
   cout << "Min (-12,-5,-1) = " << Min (-12,-5,-1) << endl;
   cout << "Min (15,-5,8)   = " << Min (15,-5,8) << endl << endl;

   cout << "FirstInAlphabet ('C', 'K') = " << FirstInAlphabet ('C', 'K') << endl;
   cout << "FirstInAlphabet ('r', 'd') = " << FirstInAlphabet ('r', 'd') << endl;
   cout << "FirstInAlphabet ('Z', 'a') = " << FirstInAlphabet ('Z', 'a') << endl << endl;

   cout << "EqualChar ('C', 'C') = " << EqualChar ('C', 'C') << endl;
   cout << "EqualChar ('r', 'd') = " << EqualChar ('r', 'd') << endl;
   cout << "EqualChar ('A', 'a') = " << EqualChar ('A', 'a') << endl << endl;
 

   for (Counter = 1; Counter <= 9; Counter ++)
   {
     cout << "Even (" << Counter << ") = " << Even (Counter) << endl;
     if (Counter == 9)
        cout << endl << endl;
   }

  for (Counter = 1; Counter <= 9; Counter ++)
  {
     cout << "Odd (" << Counter << ") = " << Odd (Counter) << endl;
     if (Counter == 9)
        cout << endl << endl;
  }

  cout << "################################ End of Main ######################";
  return (0);
}
 

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                   Square                                     // 
//                                                                              // 
// Purpose : Given a value N, Square explicity returns N Square.                // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
long int Square (long int No)
{
  return (N * N);
}

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                   Cube                                       // 
//                                                                              // 
// Purpose : Given a value N, Cube explicity returns N Cube.                    // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
long int Cube (long int No)  // Not The Best Solution
{
long int
   CubeValue;

   CubeValue = No * No;
   CubeValue = CubeValue * No;
   return (CubeValue);
}

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                   Fact                                       // 
//                                                                              // 
// Purpose : Given a value N, Fact explicity returns N Factorial.               // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
long int Fact (long int No)
{
// You Do
 return (No);
}

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                   Max                                        // 
//                                                                              // 
// Purpose : Given values No1,No2, & No3, Max explicity returns the largest     // 
//           of the three.                                                      // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
long int Max (long int No1, long int No2, long int No3 )
{
// You Do
 return (No1);
}

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                   Min                                        // 
//                                                                              // 
// Purpose : Given values No1,No2, & No3, Min explicity returns the smallest    // 
//           of the three.                                                      // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
long int Min (long int No1, long int No2, long int No3 )
{
// You Do
 return (No1);
}

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                FirstInAlphabet                               // 
//                                                                              // 
// Purpose : Given characters Ch1 & Ch2, FirstInAlphabet explicity returns      // 
//           the character which is first in the ASCII Colating Sequence.       // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
char FirstInAlphabet (char Ch1, char Ch2)
{
// You Do
 return (Ch1);
}

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                EqualChar                                     // 
//                                                                              // 
// Purpose : Given characters Ch1 & Ch2, EqualChar explicity returns            // 
//           true if the characters are the same; otherwise false.              // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
bool EqualChar (char Ch1, char Ch2)
{
// You Do
 return (true);
}

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                     Even                                     // 
//                                                                              // 
// Purpose : Given value No, Even explicity returns true if No is divisible by  // 
//           two; otherwise return false.                                       // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
bool Even (long int No)
{
// You Do
 return (false);
}

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                     Odd                                      // 
//                                                                              // 
// Purpose : Given value No, Odd explicity returns false if No is divisible by  // 
//           two; otherwise return true.                                        // 
//                                                                              // 
// Written By :                                     Environment :               // 
// Date       :                                     Compiler    :               // 
////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
bool Odd (long int No)
{
// You Do
 return (true);
}
 

}

2] Fact (1) = 1, Fact(2) = 2, Fact(3) = 6, Fact(4) = 24, etc. Fib (1) = 1, Fib(2) = 1, Fib(3) = 2, Fib(4) = 3, Fib(5) = 5, etc.

3] Change the ???? (in the comment) to your name(s).

4] Write the code for Explicit Functions Square, Cube, Fact, Max, Min, FirstInAlphabet, EqualChar, Even, & Odd

5] The program will be compiled with the following line of code:
g++ ExplicitFunctions.cpp

6] The following line of code will execute your program and send the output to a file called Output.txt
a.out > Output.txt

7] Each and every module that you turn in this semester shall contain a documentation block at the top. State the purpose clearly!

/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
//                            ClearScreen                                      //
//                                                                             //
// Purpose    : Clear the console window on a UNIX/Linux System.               //
//                                                                             //
// Written By : Dr. Thomas E. Hicks                  Environment : Linux       //
// Date       : 9/10/00                              Compiler    : g++         //
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

8] Start Visual C++.  Set the left margin to 1 " and the right margin to .5". Make the font Courier 8 or New Courier 8. Print ExplicitFunctions.cpp and Output.txt

9] Copy files ExplicitFunctions.cpp and Output.txt to a floppy disk. Copy files ExplicitFunctions.cpp and Output.txt to a second floppy disk. Keep one of these disks as a backup.



10] Those Labs labeled "Individual Assignment" are to be done separately by each individual. Using a pen,  each individual is to print  his/her name at the top of this document in the space provided and sign it.  Those Labs labeled "Team Assignment" may be done as a team or individually. Using a pen,  each individual on the team is to print print his/her name at the top of this document in the space provided and sign it. Submit only one copy of team assignments!

Include the following in your wire-band binder:

A] Turn In One Copy Per Team!

B] Divider

C] Copy of this assignment sheet. Using an ink pen, print your name and sign this lab at the top.

D] ExplicitFunctions.cpp  printout.

E] Output.txt printout.

F] Disk containing the files.