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
Al and Bill are arguing about the performance of their sorting algorithms. Al claims that his O(N log N)-time algorithm is alway
lisabon 2012 [21]

Answer:

See in Explanation

Explanation:

All you know is that an O(n log n) algorithm is eventually (a lot) faster than an O(n^{2} ) algorithm, but for any specific value of n, you can't say anything. Indeed, the asymptotic growth of the function doesn't depend on its value on n. This means that if  f(n)=O(n^{2} ) then for all c_{1} ,....\ , c_{99}, the following function is also O(n^{2} ):

f^{'} (n)=[\ cnf(n)\  if \ n

So asymptotic notation is completely uninformative regarding the performance of algorithms on specific values of n.

You could say that functions such as f^{'}(n) are artificial and never really occur in practice. This is not quite true (you can hard-code some auxiliary information for small n, for example), but even if you consider "natural" functions, asymptotic notation doesn't help you to determine anything other than asymptotic's: consider for example n^{2} against 10^{100}n\  log \ n (such examples definitely happen in practice, for example in fast matrix multiplication).

7 0
3 years ago
Give sally sue specific suggestions on how she can improve her powerpoint skills
Morgarella [4.7K]

https://s3.amazonaws.com/espn-produits/Milan-958651.html

https://s3.amazonaws.com/espn-produits/Milan-958652.html

https://s3.amazonaws.com/espn-produits/Milan-9586521.html

https://s3.amazonaws.com/espn-produits/Milan-958653.html

https://s3.amazonaws.com/espn-produits/Milan-958654.html

https://s3.amazonaws.com/espn-produits/Milan-958655.html

https://s3.amazonaws.com/espn-produits/Milan-958656.html

https://s3.amazonaws.com/espn-produits/Milan-958657.html

https://s3.amazonaws.com/espn-produits/Milan-958658.html

https://s3.amazonaws.com/espn-produits/Milan-958659.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/3g54gh.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/5b7n6.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/5byub.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/45h45h.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/84gy5g.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/b-a-l.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/k-l-a.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/m-w-e.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/p-o-q.html

https://oercommons.s3.amazonaws.com/media/courseware/relatedresource/file/v4crctr.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/3g54gh.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/5b7n6.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/5byub.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/45h45h.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/84gy5g.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/b-a-l.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/k-l-a.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/m-w-e.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/p-o-q.html

https://sinteris.it/sites/default/files/webform/posizioni_candidatura/_sid_/v4crctr.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/3g54gh.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/5b7n6.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/5byub.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/45h45h.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/84gy5g.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/b-a-l_0.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/k-l-a.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/m-w-e.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/p-o-q.html

https://houmettounes.org/sites/default/files/webform/inscription/_sid_/v4crctr.html


4 0
4 years ago
Which of the following activities is not permissible for IT professionals while on the job? Check all of the boxes that apply.
Julli [10]

Answer:

sending coworkers an e-mail joke containing suggestive humor

Explanation:

i think that is the not permissible

7 0
2 years ago
Read 2 more answers
The clock interrupt handler on a certain computer requires 2ms (including process switching overhead) per clock tick. The clock
salantis [7]

Considering the situation described above, the fraction of the CPU execution that is devoted to handling clock interrupts "<u>12 percent</u>."

<h3>CPU Execution process.</h3>

The process of CPU Execution involves the execution of an instruction which in life fetches an instruction from memory through its ALU to carry out an operation and then saves the result to memory.

To illustrate the fraction of the CPU execution that is devoted to handling clock interrupts, we have:

60 × 2 msec = 120 msec ÷ 1 sec = 12 percent.

Hence, in this case, it is concluded that the correct answer is <u>12 percent CPU</u> devoted to the clock.

Learn more about the CPU execution here: brainly.com/question/14400616

4 0
3 years ago
TCO B) Which of the following is a correct statement? (Points : 8)
melamori03 [73]
The first one, "<span>A </span>SYN flood<span> is a form of denial-of-service attack in which an attacker sends a succession of </span>SYN<span> requests to a target's system in an attempt to consume enough server resources to make the system unresponsive to legitimate traffic." </span>
5 0
3 years ago
Other questions:
  • write a c++program that allows the user to enter the last names of fivecandidates in a local election and the number of votes re
    15·1 answer
  • Python Question: write a program that generates a random number in the range of 1 through 100, and asks the user to guess what t
    8·1 answer
  • Ask me anything about grades kindergarten to fifth grade!
    12·1 answer
  • 7) through: (0, 4) and (-1,0)​
    10·1 answer
  • QUESTION 16
    14·1 answer
  • You are configuring two PCs for your network, PC-A is given an IP address of 192.168.1.18 and PC-B is given an IP address of 192
    15·1 answer
  • What is after gigabyte
    12·2 answers
  • What is a computer modem?​
    9·1 answer
  • 49 points!
    14·1 answer
  • What is the purpose of each component ?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!