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
At a local burger chain, a customer became extremely angry. Everyone took notice at the person, who was yelling at anyone he cou
leonid [27]

Answer: Donald, the branch manager displayed people skills  

Explanation: People skills are a combination of behavior and behavioral interactions between people. There are many abilities that fall under the category of people skills, for example, personal effectiveness, interactive skills and negotiation skills. While the customer was shouting, Donald patiently heard and tried to calm the customer which reflected that he respected and valued the customer and kept a positive behavior towards the customer.


5 0
3 years ago
Read 2 more answers
Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (a
allsm [11]

Answer:

The code is below. The output is "Eric went to Chipotle to buy 12 different types of Cars"

Explanation:

import java.util.scanner;

public class labprogram {

    public static void main (string [ ] args) {

    scanner scnr = new scanner (system.in) ;

    string firstname;

    string genericlocation;

    int wholenumber;

    string pluralNoun;

   firstName = scnr.next();

   genericLocation = scnr.next();

   wholeNumner = scnr.nextInt();

   pluralNoun = scnr.nextLine();

   system.output.println(firstname + " went to " + genericlocation + " to buy " + wholenumber + " different types of " + pluralnoun + " . ");

}

 }

6 0
3 years ago
Is 37 words per minute when typing an okay grade?
Olegator [25]
It is okay but you should be able to type up to 60+ words per minute and keep doing that to practice then if you can get into a typing class.
4 0
3 years ago
Read 2 more answers
A user logs in to a virtual world and creates an animated character representing themselves, which they then use to move through
Romashka [77]

A type of animated character that represents a user in the virtual world, which is used to move throughout the world and interact with other characters and objects is called an <u>avatar</u>.

<h3>What is an avatar?</h3>

An avatar can be defined as a type of animated character that is designed and developed by a software developer to represent a user or player in the virtual world, which is used to move throughout the world and interact with other characters and objects.

In gaming technology and software development, an avatar is typically used to denote a user's (player's) character in the gaming world, virtual world or computer-simulated environment, either in two-dimensional (2D) or three-dimensional (3D).

Read more on avatar here: brainly.com/question/26479902

4 0
2 years ago
Read 2 more answers
Types in java are divided into two categories. the primitive types are boolean, byte, char, short, int, long, float and double.
Rudik [331]
Types in java are divided into two categories. the primitive types are boolean, byte, char, short, not, long, float, and double. all other types are REFERENCE types
4 0
2 years ago
Other questions:
  • How do you uninstall a program using the Control Panel?
    10·1 answer
  • Bitnet, one of the predecessors of the internet was launched in 1981. what does bitnet stand for?
    12·1 answer
  • Your program will demonstrate use of arrays, searching an array, using methods, passing parameters by reference, returning value
    13·1 answer
  • A list of pages within a Web site that you have visited and that usually appears at the top of a page is referred to as a(n) ___
    14·1 answer
  • Proper numeric keyboarding technique includes:
    15·1 answer
  • You may nest while and do-while loops, but you may not nest for loops<br><br><br><br> True False
    10·1 answer
  • Which of the following is an advantage of using
    6·2 answers
  • How was the Big Ben project similar to the investigation you conducted in class to determine if the table was vibrating? How is
    7·1 answer
  • Have some points part 6<br>anyone know how to change my username?​
    11·2 answers
  • 4. When working at the CLI in Linux, you specify the exact location of a file, which is the ____________________ to it, by begin
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!