Write a program that reads a stream of integers from a file and prints to the screen the range of integers in the file (i.e. [lowest, highest]). You should first prompt the user to provide the file name. You should then read all the integers from the file, keeping track of the lowest and highest values seen in the entire file, and only print out the range of values after the entire file has been read.

Answers

Answer 1

Answer:

This question is answered using C++ programming language

#include <fstream>

#include<iostream>

using namespace std;

int main() {

  string fname;

  cout<<"Enter Filename: ";

  cin>>fname;

  int lowest = 0;

int highest = 0;

  ifstream ifs(fname);

  int x;

  while (ifs >> x){

  if(x < lowest){

   lowest= x;

  }

  if(x > highest) {

   highest = x;

  }

  }

  ifs.close();    

  for(int i = lowest; i<=highest;i++)

  {

   cout<<i<<" ";

  }

     

}

Explanation:

This line declares fname as string  

string fname;

This prompts user for filename

  cout<<"Enter Filename: ";

This gets filename

  cin>>fname;

This declares and initializes lowest to 0

      int lowest = 0;

This declares and initializes highest to 0

int highest = 0;

This defines the file using ifstream

  ifstream ifs(fname+".txt");

This declares x as integer. x is used to read integers in the file

  int x;

The following iteration will be repeated until there is no other integer to be read from the file

  while (ifs >> x){

This checks for lowest

  if(x < lowest){

   lowest= x;

  }

This checks for highest

  if(x > highest) {

   highest = x;

  }

  }

This closes the file. i.e. the file has been read

  ifs.close();    

The following iteration prints the range of values from lowest to highest

  for(int i = lowest; i<=highest;i++)  {

   cout<<i<<" ";

  }  

Please note that the filename must be entered with its extension


Related Questions

You need to update your router settings, so you log into the administration panel, Whose Internet protocol (IP) address is 192.168.0.1. which IP version is this?

A-IPv4
B-IPv2
C-IPv6
D-IPv1

Answers

Answer:

D

Explanation:

How can you get access to help? Check all that apply

Answers

Answer:

The answer is "F1"

Explanation:

Please find the complete question in the attachment file.

The F1 key is also known as the function key, which can be used to configure on a device or console key to cause such actions, a form of a soft button, to also be performed by a web browser control parser or software application. The main purpose of the F! key is to open the Help screen for all programs.

Analyze the needs of the National Security team and help them articulate its problems, develop solutions to meet its needs, and deliver a recommendation that is aligned with the extant national objectives.

Answers

Answer:

Following are the solution to this question:

Explanation:

The Council's role has been to assist and support the President regarding national security and foreign policies ever since its inception under Truman. This Committee often acts as the primary arm of a President to organize these initiatives between government agencies.

The Leader holds sway over the NSC. Its Secretary Of Defense offers a range of options for the Administration on policy issues. The director of national intelligence helps prepare the administration's foreign travel, among other tasks, and offers context memos and staffing for the administration's discussions and phone interviews involving global leaders.

Safety investments were taken for many years utilizing threat cost-benefit analysis wherein the effect metric has been largely focused on even a risk reduction comparative estimate. To evaluate investment decisions, most aim to conduct similar analyses.

Even so, the potential threat is much harder to measure for high-security installations that potential hazard since the likelihood of an attack is highly uncertain and depends strongly on undefinable psychological factors like deterrence as well as the intensity of enemy goals.

Question 24 Multiple Choice Worth 5 points)
(01.04 MC)
Zavier needs to compress several files. Which file type will allow him to do this?
ODOC
GIF
OJPG
O ZIP

Answers

Answer:

ZIP

Explanation:

ZIP is a type of compression file as Jpg is a picture file, Gif is a picture file, and ODOC stands for Oklahoma Department of Corrections

TBH:

it may be O ZIP but i've never heard of it.

Answer:

Zip (D)

Explanation:

Took The Test

A hacker successfully modified the sale price of items purchased through your company's web site. During the investigation that followed, the security analyst has verified the web server, and the Oracle database was not compromised directly. The analyst also found no attacks that could have caused this during their log verification of the Intrusion Detection System (IDS). What is the most likely method that the attacker used to change the sale price of the items purchased

Answers

Answer:

By modifying the hidden form values that is in a local copy of the company web page

Explanation:

In a situation were the hacker successful change the price of the items he/she purchased through the web site of the company's in which the company web server as well as the company Oracle database were not compromised directly which means that the most likely method in which the attacker used to modified the sale price of the items he/she purchased was by modifying the HIDDEN FORM VALUE that was in the local copy of the company web page making it easy for the HIDDEN FORM VALUE to be vulnerable to the hacker because the hidden form value did not store the company server side information or data but only store the company software state information which is why HIDDEN FORM VALUE should not be trusted.

Benjamin took a photo that focused on certain part of an image while blurring out the rest. What is this effect called?
A.
alternate focus
B.
major focus
C.
minor focus
D.
selective focus

Answers

Answer:

(D) selective focus

Explanation: hope this helps!

Answer:

D. Selective Focus

Explanation:

Photographers commonly use the tilt-shift effect to focus on a certain part of the image while blurring the rest of the photograph. They refer to this as selective focus.

You already know how to use lists. What is the index of 5 in the following list? [2, 3, 5, 1, 6]

Answers

Answer:

it's 2

Explanation:

it goes 0, 1, 2.

The index of 5 in the following list [2, 3, 5, 1, 6] is 2. The correct option is b.

What is a list in computer language?

A list is a collection of items that can be ordered or unordered. Adding, removing, and storing items are just a few of the many uses for lists. However, the software needs adequate memory to keep up with changes made to the list in order for the programmer to do the various duties for the list.

An ordered group of values is a list. The components of a list are referred to as its elements or items. An ordered list of numbers (or other items like geometric objects) is referred to as a sequence, and it frequently follows a certain pattern or function.

A list is a series of different variables that are all gathered under one common name. Rather than creating a program with numerous variables,

Therefore, the correct option is b, 2.

To learn more about the list, refer to the link:

https://brainly.com/question/14297987

#SPJ2

The question is incomplete. Your most probably complete question is given below:

O 4

02

O 1

03

You manage a Windows server that has an attached printer that is used by the Sales department. The sales manager has asked you to restrict access to the printer as follows:Sally needs to connect to a printer, print documents, and pause and resume her own print jobs.Damien needs to pause and resume documents for all users, but does not need to change printer properties.You want to assign the most restrictive permissions that meet the sales manager's requirements. What should you do

Answers

Answer:

Damien would be assign the Manage Documents permission while Sally on the other hand will be assign the permission to print.

Explanation:

Based on the information given in order for me to assign a restrictive permission that will meet the requirements of the sale manager's what I will do is for me to assign the Manage Documents permission to Damien reason been that Damien only needs to stop and resume the documents for all users in which he does not need to change the printer properties and to assign the permission to print to Sally reason been that Sally only needs to connect to a printer and to print documents in which she will then stop and resume her own print jobs.

Exodia
Principle of Computer Operation​

Answers

Answer:

????

Explanation:

if opening capital is ks 70000 and closing capital is ks 90000 what is the amount of profit or loss​

Answers

Wait, where’s the picture and answer choices ? For the answer

Explanation:

if opening capital is ks 70000 and closing capital is ks 90000 what is the amount of profit or loss

Jorge is sending a message to Thomas but would like a copy sent to his external email address as well. Jorge does not want Thomas to see this copy that was sent.

Which mail field will Jorge use to achieve this goal?

To:
From:
CC:
BCC:

Answers

Answer:  BCC (fourth choice)

=================================================

Explanation:

CC stands for "carbon copy".

BCC stands for "blind carbon copy".

Filling out forms is a tedious process. It's even more tedious when you have to repeat yourself multiple times. Carbon copy paper technology allows you to fill out one form and have those inputted entries be copied to the layers below. In terms of email, a carbon copy (CC) email is just an email sent to more than one person. In the CC line, recipients can see who the other people are in the email chain.

In contrast, a blind carbon copy is where the recipients cannot see who is in the BCC line. This allows Jorge to send the message copy to an external address without Thomas knowing.

Suppose a switch is built using a computer work station and that it can forward packets at a rate of 500,000 packets per second, regardless (within limits) of size. Assume the workstation uses direct memory access (DMA) to move data in and out of its main memory, which has a bandwidth of 2 Gbps, and that the I/O bus has a bandwidth of 1 Gbps. At what packet size would the bus bandwidth become the limiting factor

Answers

Answer:

When the transmission exceeds 667 packets

Explanation:

In computer networking, a packet is a chunk of data transmitted across the network. The packet size of an Ethernet network is 1.5kilobytes, while the packet size of an IP packet payload is 64 kilobytes.

A switch is a physical network device that connects nodes or workstations while communicating the packets (or frames). The I/O bus size bandwidth is 1Gbps which allows approximately 667 packets. Once this packet size is crossed, the bus becomes a limiting factor or bottle neck.

The material inspection and recieving report the multi-purpose document that serves as evidence of inspection and acceptance, shipping document, receiving document, and contractor invoice is designated as the:________.

Answers

Answer:

DD Form 250

Explanation:

DD Form 250 which is an acronym for Department of Defense Form 250.

It is the Material Inspection and Receiving Report that is used for contracts supplies and services including acquiring noncommercial commodities such as:

1. Acknowledgment of equipment by the Government

2. Contractor's invoice for expense.

3. loading record for hauling and acquiring.

4. Proof of Government Quality assessment.

Hence, in this case, the correct answer is DD Form 250.

g Create a Java program that takes input of a list of integers from the user, stores them into an array and then finally uses the array contents to output the list of integers in reverse. The user's input begins with the number of integers to be stored in the array. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers.Create a Java program Ex: If the input is: 8 5 2 3 4 10 6 8 9

Answers

Answer:

import java.util.Scanner;

public class Main{

public static void main(String[] args) {

int arraylent;

Scanner input = new Scanner(System.in);

System.out.print("Array Length: ");

 arraylent= input.nextInt();

int[] myarray = new int[arraylent];

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

    myarray[i] = input.nextInt();

for(int i = arraylent-1; i>=0;i--)

System.out.println(myarray[i]);

}

}

Explanation:

This declares the length of the array

int arraylent;

This next two lines prompt and get the array length i.e. number of input

System.out.print("Array Length: ");

 arraylent= input.nextInt();

This declares the array as type integer. And the length of the array is gotten from the user input

int[] myarray = new int[arraylent];

This gets the items of the array

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

    myarray[i] = input.nextInt();

This reverse and prints the array

for(int i = arraylent-1; i>=0;i--)

System.out.println(myarray[i]);

For an interview, the most used microphone types are

A. Boom mics, long range mics
B. Strap, studio recording mics
C. Lapel or handheld
D.No mics are needed

Answers

The answer is A; hope this helps you

write a function named list_total that accepts a list as an argument (assume the list contains integers) and returns the cumulative total of the values in the list

Answers

Answer:

def listSum(mylist):

  sum =0

  for item in range(0,len(mylist)):

      sum=sum+mylist[item]

  print(sum)

Explanation:

Using the Python programming language, I defined a function as listSum that accepts a list as a parameter and returns the sum of the elements in the list.

The most important logic here is defining the range of elements in the list not to exceed the length of the list using the len function. Then using a for statement, we loop through each element and add them up to a sum variable initially assigned the value of 0.

For all programs, you should write a small amount of code and _______
it before moving on to add more code?

Answers

Answer:

test

Explanation:

One newly popular development paradigm is "test-driven development"; which borrows agile engineering principles in architecting project components.

Is it important to study information systems

Answers

Answer:

There is massive importance if you want to study information study.

It can help you understand the data, organize, and process the data, using which we can generate and share information.

Explanation:

It largely depends on your interest and requirement, but a better knowledge or clue about information systems may help analyze the data especially if you want to become a data scientist, machine learning, Artificial intelligence or deep learning, etc.

It can help you understand the data, organize, and process the data, using which we can generate and share information.

A great understanding of information systems may exponentially increase the productivity, growth, performance, and profit of the company.

Most Professions get exposed to information Systems no matter what their career objective is, as it may help in having better decision making based on the information they get through data.

So, yes!

There is a massive importance if you want to study information study.

If I want to control the aperture and I want the camera to control the shutter speed which setting on the mode dial is most appropriate?
a)AV
b) TV
c) M
d) P
since this is my last question im giving 100 points and brainliest

Answers

Answer:

answer is a

hopes this helps

what stage is the most inner part of the web architecture where data such as, customer names, address, account numbers, and credit card info is the store?

Answers

Never store the card-validation code or value (three- or four-digit number printed on the front or back of a payment card used to validate card-not-present transactions). Never store the personal identification number (PIN) or PIN Block. Be sure to mask PAN whenever it is displayed.

Adam is so good at playing arcade games that he will win at every game he plays. One fine day as he was walking on the street, he discovers an arcade store that pays real cash for every game that the player wins - however, the store will only pay out once per game. The store has some games for which they will pay winners, and each game has its own completion time and payout rate. Thrilled at the prospect of earning money for his talent, Adam walked into the store only to realize that the store closes in 2 hours (exactly 120 minutes). Knowing that he cannot play all the games in that time, he decides to pick the games that maximize his earnings
Sample game board at the arcade GAME COMPLETION TIME (in minutes) PAYOUT RATE Pac-man 90 400 Mortal Kombat 10 30 Super Tetris 25 100 Pump it Up 10 40 Street Fighter II 90 450 Speed Racer 10 40
An acceptable solution is the one where it still picks the best earnings even when the list of games or completion times or payout rates change.
Question:
Write code in Java/Scala/Python to help Adam pick the sequence(s) of games that earn him the most money?.
Then, assume you have a variable list of games and their payout rates. What is the best way to pick the games that earn you the most?
Input Explanation
The first line of input is always an integer denoting many lines to read after the first line. In our sample test case, we have 6 in the first line and 6 lines after the first line, each having a game, completion_time and payout_rate.
In each data line, the game, completion_time and payout_rate are separated by a ','(comma).
The games board may change but the store still closes in 120 minutes.
Input
6
Pac-man,80,400
Mortal Kombat,10,30
Super Tetris,25,100
Pump it Up,10,40
Street Fighter II,90,450
Speed Racer,10,40
Output Explanation
Print the game names that earn him the most into the standard output in alphabetical order
Output
Mortal Kombat
Pump it Up
Speed Racer
Street Fighter II

Answers

Answer:

ask it to ur teacher boiiiiii

What is the best approach to testing a website? visit all pages to verify that they load visit every page and verify all links visit the pages with hyperlinks visit all pages that appear on the navigation menu

Answers

Answer:

B. visit every page and verify all links

Explanation:

I just took the test, and only one year late.

Answer:

THe answer s b

Explanation:

It is said that Wifi repeater is not good as a rumor

Answers

True your welcome bue

Course Aggregation Many times, departments are only interested with how students have done in courses relative to a specific major when considering applicants for admission purposes.
For this problem you are given a dictionary where the keys are strings representing student ids and the values are dictionaries where the keys represent a course code and the value represents a grade. Your task is to write a function that given a dictionary of the described format and a prefix for course codes, return a dictionary where each key is a student id and the corresponding value is the average grade of the student only in courses that start with the given prefix.
def course_grader (student_to_grades, course_prefix): ({str, {str, float}}) -> {str, float} I: a dictionary containing the grades of students (as described above) and a course code prefix P: compute and store the average grade of all students only for courses that start with the given course prefix 0: a dictionary of student ids to average grades as described in the Processing step pass

Answers

Answer:

def course_grader(student_to_grades, course_prefix):

   student_grades = dict()

   for key, value in student_to_grades.items():

       grade_score = 0

       for course,grade in value.items():  

           if course_prefix == course:  

               grade_score += grade

                student_grades[key] = grade_score / len(value.keys())

   return student_grades

Explanation:

The course_grader function is a python program that accepts two arguments, the student dictionary and the course prefix. The function returns a dictionary of the student id as the key and the average grade of the student as the value.

Given all of the limitations of MBR, is it still relevant in current day use?

Answers

Explanation:

MBR does have its limitations. For starters, MBR only works with disks up to 2 TB in size. MBR also only supports up to four primary partitions—if you want more, you have to make one of your primary partitions an “extended partition” and create logical partitions inside it.

A value chosen by the responder to identify a unique IKE SA is a _________.
A. Initiator SPI
B. Responder SPI
C. Flag
D. Message identifier

Answers

Answer:

Responder SPI

Explanation:

Responder SPI : Cookie of an individual referring to an application from the SA organization, a message from the SA, or a delete from the SA.

if resistors were 10 times larger what would happen to output voltage

Answers

Answer:

is there a picture to go w the question?

Display filters and capture filters can be interchanged because they use the same syntax. A. True B. False

Answers

Answer:

Very True

Explanation:

What is the name of the tab that becomes available after you add and select an image in your PowerPoint presentation?
Home
Insert
Picture
View

ASAP PLS

Answers

Answer:

INSERT

Explanation:

INSERT PCIURE

Janet needs to flag a message for follow-up in Outlook. Which option is not a default?

Today
Tomorrow
Next Week
Next Tuesday

Answers

Answer:

Explanation:

Today

Answer:

Next tuesday.

Explanation: Its to specific

Other Questions
What is the difference of the polynomials?I will give 40 points What one factor contributes most to the successful and uncontainable spread of Animalism in Animal Farm? problem: 12 = - Find the value of this expression if x = 7 and y= -2 xy^2/9 Which example shows how genetic engineering can be used in the agricultural industry?A. Two tomato plants that produce sweet tomatoes are crossed to produce offspring that also produce sweet tomatoes.B. A horse is bred with a donkey to produce a hybrid offspring that has characteristics of both parents.C. A gene for pest resistance is inserted into the genome of a corn plant.D. A sheep is cloned to produce an exact copy of the original sheep. A student places a mirror on the ground between herself and the tree so that she can see the top of thetree in the middle of the mirror. Are the two trangles formed, similar? If yes, what is the height of thetree? (GSRT 5)A}Yes, 10 ft.B) Yes, 12 ft.Yes, IA ft6 ftDj No, the trangles are not similar16 ft8t Read the excerpt from Barrio Boy by Ernesto Galarza. Next I discovered the bedsprings. When I sat on the bed it sank deliciously. Jumping on it in my stocking feet, I held my balance dangerously as I made the bed creak and the mattress bounce. The head and foot of the bed were made of iron scrollwork in loops and rosettes painted white. On each of the four posts there was a large brass knob that unscrewed. I took one off, deciding to take it with us since it matched the three cartridges in the cedar box. My plan didn't work. Doa Henriqueta ordered me to screw it back. Which sentence from this excerpt best illustrates the author's use of sensory language?next I discovered the bedspreads.when I sat on the bed it sank deliciously on each of the four posts there was a large brass knob that unscrewed.i took one off, deciding to take it with us since it matched the three cartridges solar- powered products help to save electricity as well as coal. Do you agree with this statement? Solve for x: 1/3 (x-22) = 4xx = -2 x = 34x = 2 x = -10 What is its primary function of the structure? 32. Exercise Ahmit getsexercise on the weekend byworking around the house.On Saturday, he worked for3 hours mowing the lawn andraking leaves; He burned885 Calories.a. Write a system ofequations that can be usedto describe the amountof time Ahmit worked andthe number of Calorieshe burned by mowingand rakingb. Determine how much time Ahmit spent on mowing and raking. What kind of economic system does the United States currently have?A. A traditional economyB. A mixed market economy C. A command economy D. A market economy The Answer is B. A mixed market economy -64 divided by 8 Equals Write an essay about the adventuruos activity Write the following separation techniques?a. Filtrationb. EvaporationC. Fractional distillationd. Chromatography If someone could answer this, that'd be great!(359x+1000)-(175x+.50m+62.36) How much energy is required to raise the temperature of 5.0 g of silver from 298 K to334 K? Find the distance between the two points to the nearest tenth. (0,-5) and (-4,2) 5 5.3 5.2 5.6 What is the relationship between respiration and cellular respiration? What is the difference between a partial blockage and an obstruction blockage? What is the first aid for choking? Use the sine rule to calculate BC :)