Accept positive and negative numbers in its input sequence

Assignment Help C/C++ Programming
Reference no: EM13168077

Requirements:

  • The program must accept positive and negative numbers in its input sequence, and ?nd the largest and smallest

of the numbers entered whether they are all positive, all negative, or a combination of both positive and negative.

  • Entering 0 must terminate the input sequence and cause the result to be displayed.
  • If the ?rst number entered is zero, then the input sequence is empty and a message stating this must be

displayed (as shown in the sample run below) instead of showing the largest and smallest numbers.

  • Name the source ?le for your program program2.c
  • The prompts and output displayed by the program must be formated as shown in the sample run below (e.g.

blank lines, spacing, case of text).

  • A sample run of the program with only positive numbers:

Entering 0 will terminate the sequence of input values.

Enter a number: 9

Enter a number: 5.2

Enter a number: 44

Enter a number: 0

Your largest number was 44.000. Your smallest number was 5.200.

  • A sample run of the program with only negative numbers:

Entering 0 will terminate the sequence of input values.

Enter a number: -4

Enter a number: -38

Enter a number: -5.6

Enter a number: 0

Your largest number was -4.000. Your smallest number was -38.000.

  • A sample run of the program with both positive and negative numbers:

Entering 0 will terminate the sequence of input values.

Enter a number: 6

Enter a number: 78

Enter a number: -3

Enter a number: 0

Your largest number was 78.000. Your smallest number was -3.000.

  • A sample run of the program with an empty input sequence:

Entering 0 will terminate the sequence of input values.

Enter a number: 0

Your input sequence was empty.Hints:

  • How will you keep track of whether or not any numbers have been entered? Think about what variables you

need.

  • What needs to be done di?erently when the ?rst number is read compared to when later numbers are read?
  • Are the above two items related?

 

 

Reference no: EM13168077

Questions Cloud

Compute the volume of the bottle could deliver to a climber : calculate the volume of O2 the bottle could deliver to a climber at an altitude where the temp is -38 C and the atmospheric pressure is 0.40 atm.
A "mynum" class that will read "randfile.txt" file : A "MyNum" class that will read "randFile.txt" file and obtain the 20,000 integer numbers
Input a temperature as a floating point : Your program should input a temperature as a floating point number with an appended unit letter. It should then print the temperature in all four of the units above
Explain the total pressure in the flask : determine the total pressure in the flask AND the height difference between the two arms of the manometer.
Accept positive and negative numbers in its input sequence : the program must accept positive and negative numbers in its input sequence, and ?nd the largest and smallestof the numbers entered whether they are all positive, all negative, or a combination of both positive and negative.
The analog to digital converter : The Analog to Digital converter has V(t) as its input, and it outputs a binary word B(t) with a fixed length of k bits, which is its best approximation to V(t). Suppose that V(t) can vary continuously between zero and 5 volts
Explain what is the total pressure above the solution : What is the vapor pressure of each of the solution components in the mixture? What is the total pressure above the solution?
Reflect upon the it strategies : Reflect upon the IT strategies that are used to encourage economic development. Select two strategies and discuss how economic factors affect the strategies that a government may use to facilitate economic development.
What provided the added kinetic energy : What provided the added kinetic energy?   None of these is correct. the momentum of the platform the man moving the weights further away from his body the man pulling the weights closer to his body

Reviews

Write a Review

C/C++ Programming Questions & Answers

  One time for the entire number set

You must run your program one time for the entire number set. Test for EOF (or use the function feof()) to know when to stop processing. You are to determine if each integer read is prime or not, and output the result to stdout

  We have to deal with student pilots

We have to deal with student pilots and airplanes. Students have a unique student id, a name, and a year that students are in. Airplanes have a unique airplane id, model, a cruising range

  Write a program to calculate a person''s net pay

Write a program to calculate a person's net pay after subtracting federal income tax.The program should ask the user to enter the person's name, social security number, gross pay, and the number of dependents.

  A password must have at least eight characters

A password must have at least eight characters. A password must consist of only letters and digits. A password should contain at least one uppercase letter. A password must contain at least two digits.

  Write a program with a while loop to print 1 to n in square

Write a program with a while loop to print 1 to N in square brackets. N is an integer input from the user. (i) Write the same program using a for-loop

  Write a method named negative sum

Write a method named negativeSum that accepts a Scanner as a parameter reading input from a file containing a series of integers, and determine whether the sum starting from the first number is ever negative

  Structs in an array of employee data.

Below is the instructions of my C++ Lab. The program must build in Microsoft Visual C++. Please use headers so the program will compile

  Algorithm to determine which items to take to max weight

Write an algorithm to determine which items to take to maximize the weight of his loot bag. He cannot take a fraction of an item and each item must be taken, or left behind. Loot bag size is Z and and the input is an array of item wieghts as integers..

  Write a function to compute the magnitude f

write a function to compute the magnitude F and direction angle of a two-dimensional force F by using two components of the force fx,fy as its parameters,returning F and using the reference to pass theta value .

  Write c program for linked list applications

Write a complete C program which illustrates the Linked list applications data structures and algorithms. The program will read in mid-semester test scores as Main Linked List and produce six outputs:

  Program to calculate word ladders where single-character

Write down a program in C++ to calculate word ladders where single-character substitutions have the cost of 1, and single-character additions or deletions.

  Test a program that prompts for the user

Write and test a program that prompts for the user to input a file name and uses two functions head() and tail() - head() displays the first 10 lines of a file

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd