Print Name __________________________
Signature __________________________
Print Name __________________________
Signature __________________________
Explicit Functions Fact
Team / Individual (1-2 Persons) Assignment
15 Points
| //////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////// // Program FactFib.cpp // // // // Purpose : Demonstrate Functions with Explicit Returns. // // // // Written By : Environment : // // Date : Compiler : // ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////
Includes ////////////////////////////////////
///////////////////////////////// Prototypes //////////////////////////////////// long int Square (long int No);
long int Max (long int No1, long int No2,
long int No3 );
//////////////////////////////////////////////////////////////////////////////////
cout << "###############################
Start of Main #####################\n";
for (Counter = 1; Counter <= 10;
Counter ++)
for (Counter = 1; Counter <= 10;
Counter ++)
for (Counter = 1; Counter <= 10;
Counter ++)
cout << "Max (2,5,1)
= " << Max (2,5,1) << endl;
cout << "Min (2,5,1)
= " << Min (2,5,1) << endl;
cout << "FirstInAlphabet ('C',
'K') = " << FirstInAlphabet ('C', 'K') << endl;
cout << "EqualChar ('C', 'C')
= " << EqualChar ('C', 'C') << endl;
for (Counter = 1; Counter <= 9; Counter
++)
for (Counter = 1; Counter <= 9;
Counter ++)
cout << "################################
End of Main ######################";
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
CubeValue = No * No;
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
} |
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.
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.