Question
IN C++ QUESTION ONE (1) A program has been developed to define the largest number from a set of 10 numbers. The function larger is
IN C++
QUESTION ONE (1)
A program has been developed to define the largest number from a set of 10 numbers. The function larger is used to determine the largest number. The program will read the first number of the dataset has been assigned by the user. It will assume that the first number entered is the largest number and will store it in a variable called max. The program then will read the second number and store it in num. The system will compare max and num and store the larger number into max. Now max contains the larger of the first two numbers. The program will read the third number, compare it with max and store the larger number into max. At this point, max contains the largest of the first three numbers. The program then will read the next number, compare it with max, and store the larger into max. The program will repeat this process for each remaining number in the dataset. Eventually, max will contain the largest number in the data set.
Input data is:
15 20 7 8 28 21 43 12 35 3
The following questions based on the scenario above:
- Identify the best method to be used. (2 marks)
- Define an appropriate assigned data type for function larger (2 marks)
- Write declared identifiers to be used with appropriate comment for each (6 marks)
- Define the analysis requirements. (5 marks)
- Write an algorithm to solve the problem (10 marks)
- Write a pseudocode (15 marks
- Draw a flowchart to solve the problem (20 marks)
- Write a program in C++ to solve the problem above. (30 marks)
- Write a sample output based on answer in question 1(h) (6 marks)
- Explain any FOUR (4) techniques to verify the program correctness in programming
(4 marks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started