PROGRAMMING LANGUAGE: C++ Note: Kindly refer to the attached screenshot for the sample program. 1. Identify the format of the function used: no return type & no parameter, with return type & no parameter, no return type & with parameter and with return type & with parameter. 2. Identify the format and actual parameters. 3. Identify the function signature 4. Identify parameter if value parameter, reference parameter or constant reference parameter is used. 5. Identify the the scope of variable used. 6. Identify the type of C++ function is used.

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
100%

PROGRAMMING LANGUAGE: C++

Note: Kindly refer to the attached screenshot for the sample program.

1. Identify the format of the function used: no return type & no parameter, with return type & no parameter, no return type & with parameter and with return type & with parameter.

2. Identify the format and actual parameters.

3. Identify the function signature

4. Identify parameter if value parameter, reference parameter or constant reference parameter is used.

5. Identify the the scope of variable used.

6. Identify the type of C++ function is used.

main.cpp
1 // This program reads 20 numbers and outputs the number of
2 // zeros, odd, and even numbers.
3
4 #include <iostream>
5 #include <iomanip>
7 using namespace std;
8
9 const int N = 20;
10
11
//Function prototypes
12 void initialize(int& zeroCount, int& oddCount, int& evenCount);
13 void getNumber(int& num);
14 void classifyNumber(int num, int& zeroCount, int& oddCount,
15
16 void printResults(int zeroCount, int oddCount, int evenCount);
int& evenCount);
17
18 int main (()
19
20
//Variable declaration
21
int counter; //loop control variable
22
int number; //variable to store the new number
23
//variable to store the number of zeros
//variable to store the number of odd integers
int zeros;
24
int odds;
25
int evens;
//variable to store the number of even integers
26
27
initialize(zeros, odds, evens);
//Step 1
28
29
cout <« "Please enter
<« N <«
integers."
30
<« endl;
//Step 2
31
cout <« "The numbers you entered are:
<« endl;
32
33
1; counter <= N; counter++)
for (counter
{
getNumber(number);
//Step 3
34
//Step 3a
//Step 3b
//Step 3c
35
36
cout <« number <« "
classifyNumber (number, zeros, odds, evens);
}// end for loop
37
38
39
40
cout <« endl;
41
42
printResults(zeros, odds, evens);
//Step 4
43
44
return 0;
Transcribed Image Text:main.cpp 1 // This program reads 20 numbers and outputs the number of 2 // zeros, odd, and even numbers. 3 4 #include <iostream> 5 #include <iomanip> 7 using namespace std; 8 9 const int N = 20; 10 11 //Function prototypes 12 void initialize(int& zeroCount, int& oddCount, int& evenCount); 13 void getNumber(int& num); 14 void classifyNumber(int num, int& zeroCount, int& oddCount, 15 16 void printResults(int zeroCount, int oddCount, int evenCount); int& evenCount); 17 18 int main (() 19 20 //Variable declaration 21 int counter; //loop control variable 22 int number; //variable to store the new number 23 //variable to store the number of zeros //variable to store the number of odd integers int zeros; 24 int odds; 25 int evens; //variable to store the number of even integers 26 27 initialize(zeros, odds, evens); //Step 1 28 29 cout <« "Please enter <« N <« integers." 30 <« endl; //Step 2 31 cout <« "The numbers you entered are: <« endl; 32 33 1; counter <= N; counter++) for (counter { getNumber(number); //Step 3 34 //Step 3a //Step 3b //Step 3c 35 36 cout <« number <« " classifyNumber (number, zeros, odds, evens); }// end for loop 37 38 39 40 cout <« endl; 41 42 printResults(zeros, odds, evens); //Step 4 43 44 return 0;
45 }
46
47 void initialize(int& zeroCount, int& oddCount, int& evenCount)
48 {
zeroCount = 0;
oddCount = 0;
49
50
51
evenCount = 0;
52 }
53
54 void getNumber(int& num)
55 {
56
cin >> num;
57
58
59 void classifyNumber(int num, int& zeroCount, int& oddCount,
60
61 {
int& evenCount)
switch (num % 2)
{
62
63
64
case 0:
65
evenCount++;
if (num == 0)
zeroCount++;
66
67
68
break;
69
case 1:
70
case -1:
71
oddCount++;
} //end switch
73 } //end classifyNumber
72
74
75 void printResults(int zeroCount, int oddCount, int evenCount)
76 {
77
cout <« "There are " << evenCount «
evens,
<« "which includes
<« endl;
cout <« "The number of odd numbers is:
<« endl;
78
<« zeroCount <« "
zeros"
79
80
<« oddCount
81
82 } //end printResults
Transcribed Image Text:45 } 46 47 void initialize(int& zeroCount, int& oddCount, int& evenCount) 48 { zeroCount = 0; oddCount = 0; 49 50 51 evenCount = 0; 52 } 53 54 void getNumber(int& num) 55 { 56 cin >> num; 57 58 59 void classifyNumber(int num, int& zeroCount, int& oddCount, 60 61 { int& evenCount) switch (num % 2) { 62 63 64 case 0: 65 evenCount++; if (num == 0) zeroCount++; 66 67 68 break; 69 case 1: 70 case -1: 71 oddCount++; } //end switch 73 } //end classifyNumber 72 74 75 void printResults(int zeroCount, int oddCount, int evenCount) 76 { 77 cout <« "There are " << evenCount « evens, <« "which includes <« endl; cout <« "The number of odd numbers is: <« endl; 78 <« zeroCount <« " zeros" 79 80 <« oddCount 81 82 } //end printResults
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
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
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