-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindLargestFunctionDEMO.cpp
More file actions
80 lines (57 loc) · 1.69 KB
/
Copy pathFindLargestFunctionDEMO.cpp
File metadata and controls
80 lines (57 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//************************************************************************
// Author: Rolando Carreon
// Date: mar 4 2025
// Language: C++
// Assignment: FindLargestestFunctionDEMO
// Description: display a header and footer and find the lerger of 2 ints
//************************************************************************
#include<iostream>
using namespace std;
// function prototypes
void printHeader(string);
void printFooter();
void printLine();
void largestNumber(int, int);
int main()
{
// declare local variables
int firstNumber = 10;
int secondNumber = 15;
// display the header
printHeader("Number Tester");
// get the largest number
largestNumber(firstNumber, secondNumber);
//display the footer
printFooter();
return 0;
}
// function definitions
// function to display the program header using the passed in message
void printHeader(string message)
{
printLine();
cout << "\t\t" << message << endl;
printLine();
}
// function toprint a line of asterisks used in the header and fooer
void printLine()
{
cout << "*********************************\n";
}
// function accepts to intgers, determines the largest, and displays it
void largestNumber(int numOne, int numTwo)
{
// declare local variables
int myLargestNumber;
// determine the lergest number and assign to myLargestNumber
myLargestNumber = (numOne > numTwo) ? numOne: numTwo;
// display the result
cout << "The largest number is " << myLargestNumber << endl;
}
// function to display the program footer with a specified messahe
void printFooter()
{
printLine();
cout << "\t\tEnd of Program Run\n";
printLine();
}