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
levacccp [35]
3 years ago
12

This program will read integers from a file and find results from these integers. Open the file, test to make sure the file open

ed. Use a loop to read the integers and process each integer as it is read. When End Of File is reached, close the file. After all of the integers have been read and processed, print the results for the following output: The integer count: The sum of the integers: The smallest integer: The largest integer: The average of the integers: Use notepad, vim, or other simple text editor to create a file named file1.txt containing the following, with one integer per line. Test the program two times. Use the following data in the first test: 11 9 18 22 27 33 21 For the second test add an additional line containing the number 40.
Computers and Technology
1 answer:
erma4kov [3.2K]3 years ago
4 0

Answer:

this is in cpp

#include <bits/stdc++.h>

#include<fstream>

using namespace std;

int main()

{

ifstream myfile;

myfile.open ("file1.txt");

// Check if file is opened

if (!myfile.is_open())

{

cout<<"Error: File could not be opened"<<endl;

}

else{

// variable to stor count,sum, minimum and maximum

int ct=0,sm=0,mn=INT_MAX,mx=INT_MIN;

// variable for taking input

int x;

// reading and processing in loop until there are more integers

while(myfile>>x){

ct++;

sm+=x;

mn= min(mn,x);

mx=max(mx,x);

}

// close the file when End of file is reached

myfile.close();

//printing results

cout<<"The integer count: "<<ct<<endl;

cout<<"The sum of the integers: "<<sm<<endl;

cout<<"The smallest integer: "<<mn<<endl;

cout<<"The largest integer: "<<mx<<endl;

cout<<"The average of the integers: "<<((sm*1.0)/ct)<<endl;

}

return 0;

}

Explanation:

You might be interested in
This is really not a question but yall should texts me I need friends:))
noname [10]

Answer:

if ur lonely i suggest an app/website called mylol

Explanation:

fdsjafklsuhfkjfudhjkfewuhfdjk fdjs afujijf kldsaflkdjslajrfewiofjdjsahfruifhgijdsk fdsj fds

8 0
3 years ago
Read 2 more answers
In a singing competition, there are 34 more men than women
djverab [1.8K]

Answer:

94 women are there

Explanation:

it is easy subtraction you only have to 128-34

4 0
4 years ago
Read 2 more answers
The alveolar walls and the pulmonary capillaries form the:
Murrr4er [49]

Answer:

D. respiratory membrane

Explanation:

The "alveolar walls" and the "pulmonary capillaries" are part of the <em>Respiratory System</em> of the human body. They form the respiratory membrane/respiratory surface (a very thin layer), which makes the exchange of gases possible. It functions by <u>separating the air from the blood</u>. This enables oxygen to enter our body and for carbon dioxide to go out of the body. It makes the gas exchange efficient and fast. This movement is called <em>"diffusion."</em>

7 0
3 years ago
In Scheme, the form (symbol-length? 'James) will return: Group of answer choices 0 5 6 error message
Nadya [2.5K]

Answer:

an error message

Explanation:

The return value is the value which is sent back by the function to a place in the code from where the \text{function} was called from. Its main work is to return a value form the function.

In the context, the form of  "(symbol-length? 'James)" in Scheme will return the  value --- ' an error message'.

7 0
3 years ago
What is a valid response when identity theft occurs
Alexxandr [17]

Answer:

Unsecure Passwords

4 0
3 years ago
Other questions:
  • Collaboration, listening, and negotiating are considered _____ skills.
    5·1 answer
  • Under the Right to Know Rule, employers need to include information on which one of the following in a written and complete haza
    5·1 answer
  • What range of leakage current must trip an IDCI?​
    15·1 answer
  • Which of the following is NOT an international organization?
    13·1 answer
  • Cameron is having a party and needs to write step-by-step directions on the invitation. Which type of list would you
    11·1 answer
  • Let's practice Audience analysis by going to the Google Merchandise Store demo account with a date range of Feb 1, 2016 - Feb 29
    13·1 answer
  • A user complains because the social media apps on his mobile device always note his location. The user is worried about privacy,
    12·1 answer
  • PLEASE HELP ILL MARK BRAINLIEST!!!
    10·1 answer
  • Logan has developed an excellent presentation with interesting content. He received great feedback on the evaluation
    10·1 answer
  • Who made the game Monopoly???
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!