Example 5 Rewrite example 4 to calculate the minimum of an array. That is, modify fMaxArray to write a function f MinArray that returns the minimum of the input array.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Need help with example 5 please. And written in c++.
11:29
al 55%
M8- Arrays 2 - Read-only
Read Only - You can't save changes to ...
Example 4
• Rewrite example 3 with a
function fMaxArray
that takes an int array and
1 / Ma Example 4
// Maximum of an array using function
3 tinelude ciestraan
4 Ninclude string
2
4 Nanclude
S ustng namespace std;
int fMlasarray(int al), int lungth),
8 int maint)
9.(
int al10)-(32, 21, 4), 21, 30, 11, 15, 34, 38, 14);
coutce" The maxdmun element in array is: "cclaxteray(a, 10);
its length as parameters
10
and returns the maximum
12 )
13 //Note the code is sinilar to exanple 3
of the array
int fMaxarray(int all, int longth){
int max:
max-a[e); //astume the ftrst eloment is martmam
for(int i-l; iclength; i) //start frue the second element
15
16
//maximum nunber te find
//atsume the firet olement ie maxtmum
17-
18-
19
//1s elenent greater than max
//if yes, then assign ali] te mux
naxali),
20
21
22
raturn nax
23
Notes
Comments
Eumplo 4
Emple 5
Sarting an anay
k
Rerteangkelae f The
a (Ha ayte a r
de ipa
Reteang
ta Mamay
Comp
ak s d
d themin
fte
4 e d
i
Se weie
Lednee te l e
The
9.
10
11
Transcribed Image Text:11:29 al 55% M8- Arrays 2 - Read-only Read Only - You can't save changes to ... Example 4 • Rewrite example 3 with a function fMaxArray that takes an int array and 1 / Ma Example 4 // Maximum of an array using function 3 tinelude ciestraan 4 Ninclude string 2 4 Nanclude S ustng namespace std; int fMlasarray(int al), int lungth), 8 int maint) 9.( int al10)-(32, 21, 4), 21, 30, 11, 15, 34, 38, 14); coutce" The maxdmun element in array is: "cclaxteray(a, 10); its length as parameters 10 and returns the maximum 12 ) 13 //Note the code is sinilar to exanple 3 of the array int fMaxarray(int all, int longth){ int max: max-a[e); //astume the ftrst eloment is martmam for(int i-l; iclength; i) //start frue the second element 15 16 //maximum nunber te find //atsume the firet olement ie maxtmum 17- 18- 19 //1s elenent greater than max //if yes, then assign ali] te mux naxali), 20 21 22 raturn nax 23 Notes Comments Eumplo 4 Emple 5 Sarting an anay k Rerteangkelae f The a (Ha ayte a r de ipa Reteang ta Mamay Comp ak s d d themin fte 4 e d i Se weie Lednee te l e The 9. 10 11
11:30
3 all 55%i
M8- Arrays 2 - Read-only
Read Only - You can't save changes to ...
Example 5
• Rewrite example 4 to calculate the minimum of an array. That
is, modify fMaxArray to write a function fMinArray that
returns the minimum of the input array.
Notes
Comments
Eumple 4
Emple 5
Sarting an anay
Renteanee
tn Maay
Rerteangkelae f The
madty (Maayteraften ry
e an ipa
Cop
fte
Se e e
9.
10
11
Transcribed Image Text:11:30 3 all 55%i M8- Arrays 2 - Read-only Read Only - You can't save changes to ... Example 5 • Rewrite example 4 to calculate the minimum of an array. That is, modify fMaxArray to write a function fMinArray that returns the minimum of the input array. Notes Comments Eumple 4 Emple 5 Sarting an anay Renteanee tn Maay Rerteangkelae f The madty (Maayteraften ry e an ipa Cop fte Se e e 9. 10 11
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education