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
Katyanochek1 [597]
3 years ago
10

Write a C++ program which prompts the user to enter some numbers and finds the largest number of those entered. Entering 0 shoul

d terminate the sequence of numbers and cause the largest number found to be displayed.
Computers and Technology
1 answer:
ANEK [815]3 years ago
5 0

Answer:

Following are the program in c++

#include<iostream> // header file  

using namespace std; // using namespace

int main() // main method

{

  int number, maximum; // variable declaration

  cout << "Entering the number 0 will terminate the program:\n";

  do{

      cin >> number;// read the number

      if(number == 0) // check the condition if number is 0  

      break;

      if(maximum < number) // finding the maximum number

      maximum = number; // assign the number to maximuim variable

  }while(true);

  cout << "The largest of the numbers is : " << maximum << endl;

}

Output:

Entering the number 0 will terminate the program:

19

56

560

6

0

The largest of the numbers is : 560

Explanation:

In this Program we read the number from the user in the do while loop .The loop will iterating untill user is not entered 0 also it checks the condition of finding maximum number in that loop by using if(maximum < number) statement in this condition it store the maximum number in maximum variable .

if user is entered 0 the loop will terminated and Print the maximum number.

You might be interested in
The following program uses a variable workHoursPerWeek rather than directly using 40 in the salary calculation expression.
Serjik [45]

Answer:

<u> Initial program output (from original program)</u>

Annual salary is: 40000

Monthly salary is: 3333

<u>Program output after workHoursPerWeek = 35</u>

Annual salary is: 35000

Monthly salary is: 2916

<u>Revised program (using variable workWeeksPerYear)</u>

  1.    public static void main(String[] args) {
  2.        int hourlyWage = 20;
  3.        int workHoursPerWeek = 35;
  4.        int workWeeksPerYear = 52;
  5.        int annualSalary = 0;
  6.        annualSalary = hourlyWage * workHoursPerWeek * workWeeksPerYear;
  7.        System.out.print("Annual salary is: ");
  8.        System.out.println(annualSalary);
  9.        System.out.print("Monthly salary is: ");
  10.        System.out.println((hourlyWage * workHoursPerWeek * workWeeksPerYear) / 12);
  11.        return;
  12.    }

Program output:

Annual salary is: 36400

Monthly salary is: 3033

<u>Revised Program after introducing monthly salary</u>

  1.    public static void main(String[] args) {
  2.        int hourlyWage = 20;
  3.        int workHoursPerWeek = 35;
  4.        int workWeeksPerYear = 52;
  5.        int annualSalary = 0;
  6.        int monthlySalary = 0;
  7.        
  8.        annualSalary = hourlyWage * workHoursPerWeek * workWeeksPerYear;
  9.        monthlySalary = hourlyWage * workHoursPerWeek * workWeeksPerYear;
  10.        
  11.        System.out.print("Annual salary is: ");
  12.        System.out.println(annualSalary);
  13.        System.out.print("Monthly salary is: ");
  14.        System.out.println((monthlySalary) / 12);
  15.        return;
  16.    }

Explanation:

One reason to use variable to replace the magic number is to improve the readability of the program. If we compared the revised version of the program with the original program, we will find that the variable enable our code easier to understand.

Besides, if we wish to change the value (e.g. working hours per year or per month), we just need to adjust the value assigned on the variables. The variables provide a single access point to get or change the value.

7 0
3 years ago
You want to get information about DNS request types and DNS query packet content. What kind of DNS logging do you need to enable
ololo11 [35]

Answer:

Option C i.e., Analytic event logging is the correct answer.

Explanation:

The user required to enable Analytic event logging Type of DNS logging to take data or information related to the type of DNS request and also the content packet of the DNS query. By Analytic event logging, Users get data about the forms of DNS requests and the size of the DNS query packets. That's why the following option is correct.

8 0
3 years ago
Identify the type of error.<br> print "hello"<br><br> num = 5 / 0
horrorfan [7]

Answer:

Syntax error

Explanation:

This is a type of error that occurs when there is a problem with the code that makes it unable to compile and execute.

For example, making a conditional statement without using the correct parameters will result in a syntax error.

4 0
3 years ago
Read 2 more answers
A _____ is the viewing area for a web page, which is much smaller on a phone than on a traditional desktop.
-BARSIC- [3]
A viewport is the viewing area for a web page, which is much smaller on a phone than on a traditional desktop .
6 0
3 years ago
What is the best way to delete a program that you downloaded that says that its open but its not opened in your screen? I will g
NNADVOKAT [17]

Answer:

Ctrl+Alt+Del and open Task Manager. Right-click and select End Process. Proceed with uninstalling the program as normal, now that the program has been closed.

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • What are the changes in ios 14.2? What are the benefits of the ios developer program? What is next for Apple? Base your answers
    14·1 answer
  • Many computer users and some operating systems call subdirectories ____.
    10·1 answer
  • What tool do you use to secure remote access by users who utilize the internet??
    7·1 answer
  • Which of the following is considered both an input and output peripheral?
    10·1 answer
  • Developers and organizations all around the world leverage ______ extensively.
    9·2 answers
  • Select the instances in which you should include a comma.
    13·1 answer
  • #5 Multiple Select Which of the following describes a hardware error? Select 3 options.
    7·2 answers
  • 6. 6. While printing a document, what are the options available in the Settings section?
    9·1 answer
  • ​ In the U.S., a work that was created in 2000 by an individual author who died in 2005 will be protected by copyright until ___
    5·2 answers
  • A is a program for editing,rearranging and storing text
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!