1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
VLD [36.1K]
3 years ago
13

(Complete the Problem-Solving discussion in Word for Programming Challenge 2 on page 404. Your Problem-Solving discussion should

include Problem Statement, Problem Analysis, Program Design, Program Code and Program Test in Words Document.) Create a program that will find and display the largest of a list of positive numbers entered by the user. The user should indicate that he/she has finished entering numbers by entering a 0.
Computers and Technology
1 answer:
zimovet [89]3 years ago
6 0

Answer:

The approach to the question and appropriate comments are given below in C++

Explanation:

Problem statement:

Write a program that will find and display the largest of a list of positive numbers entered by the user. The user should indicate that he/she has finished entering numbers by entering a 0.

Problem Analysis:

It can be completed in worst-case O(n) complexity, best case O(1) (if the first number is maxed element)

Program Design:

1. Start

2. Take the list of positive numbers for the user until he/she enter 0.

3. store the entered numbers in an array

4. find the max number from it.

5. Print the output

6. End

Program Code:

#include<iostream>

using namespace std;

int main(){

  int num = 0, *array = NULL, i= 0, counter = 0, max = 0;

 

  cout<<"Enter a list of positive numbers to find the maximum out of it and if you enter 0 that is the last number: \n";

  array = new int;

 

  /*Taking input from user until he/she enters 0*/

  while(1){

      cin>>num;

      array[i] = num;

      i++;counter++;

      if(num == 0)

          break;  

  }

 

  cout<<"Print user input numbers: \n";

  for(int i=0;i<counter;i++)

      cout<<"list["<<i<<"] --> "<<array[i]<<"\n";

  cout<<"\n";

 

  /*Find max element*/

  max = array[0];

  for(int i=0;i<counter;i++){

      if(array[i] > max)

          max = array[i];  

  }

  cout<<"Max number = "<<max<<"\n";      

  delete array;  

  return 0;

}

You might be interested in
Explain with the help of an example that family background affects the entrepreneurial behaviour of people
marta [7]

Answer:

Like other aspects, family background also affects the entreptrneurial behaviour of people as entrepreneurship directly depends on people and people are affected to big extent by the family background.

Explanation:

  • According to the research statistics 25% of the variation in decisions of individuals to become employed to self is explained by family background and influence of the community.
  • It also suggested that the entrepreneurship depends upon sibling correlation and shared genes.
  • It is greatly affected by characteristics of parents and family members including sibling peer effects, income, education, self employment, neighbourhood effects and incorporation.
3 0
3 years ago
The automotive system that connects the engine and the transmission to the wheels is called the
insens350 [35]
I believe the driveshaft 

8 0
2 years ago
How can i become an ailen?
DIA [1.3K]
Go to a different state as a migrant and then your a alien
8 0
3 years ago
Read 2 more answers
Your company has a team of remote workers that need to use Windows-based software to develop company applications, but your team
timofeeve [1]

Operating systems are the software that supports the basic functioning of the computer. Windows Virtual Desktop is an Azure compute service that will help solve the problem.

<h3>What is Windows Virtual Desktop?</h3>

Windows Virtual Desktop is an app virtualization service of Azure that operates on the cloud platform. It includes standard operating procedures that can be used by users with multiple OS.

Azure's Virtual Desktop supports different versions of window OS. This type of system is majorly used in remote work demands and specialized workloads.

Therefore, Windows Virtual Desktop is an Azure compute service.

Learn more about Azures service here:

brainly.com/question/13144160

#SPJ1

5 0
1 year ago
A web designer is creating a web site and wants each browser to resize the text size to look the same in each device. what measu
adelina 88 [10]
The designer could use the measurements in pixels. 
4 0
3 years ago
Other questions:
  • _____ provide the standards, syntax, statements, and instructions for writing computer software
    14·1 answer
  • You're working at a large industrial plant and notice a tag similar to the one shown in the figure above. Which of the following
    5·1 answer
  • What is a way to Procter your social security number and other sensitive information from identity theft
    9·1 answer
  • What is the maximum number of communication paths for a team of twenty people?
    5·1 answer
  • What are the key goal, performance, and risk indicators?
    15·1 answer
  • Jeremy’s office is in an earthquake prone area. His web server is in his office. What step should he take to protect the data on
    5·1 answer
  • Which of the following Internet protocols is used to request and send pages and files on the World Wide Web?
    15·1 answer
  • 01110100 01101000 01101001 01110011 00100000 01110011 01110101 01100011 01101011 01110011 00100000 01100010 01100001 01101100 01
    12·2 answers
  • What makes a source credible?
    9·2 answers
  • Select one Layer 2 or wireless WAN technology presented in Lesson 3. Elaborate on its characteristics, pros and cons, and common
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!