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
trasher [3.6K]
3 years ago
7

Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he o

r she is finished providing inputs. After the user presses the enter key, the program should print: The sum of the numbers The average of the numbers An example of the program input and output is shown below:
Computers and Technology
1 answer:
Whitepunk [10]3 years ago
7 0

Answer:

Below program is in C++ Programming Language

Explanation:

Code explanation is in comments, the line starts with // .

// Import all necessory files

#include<iostream>

#include<string>

#include<sstream>

using namespace std;

int main()

{

//Declaring input string to get data from user

string myinput="";

// getline will get input string from user through command prompt

getline(cin, myinput);

//stringstream will be used to get one by one inputed number //seperated by space

//stringS is the name we set for stringstream

stringstream stringS(myinput);

// num will be used to get space seperated number from stringstream

int num = 0;

int sum=0;

// we need to count total numbers enterd by user to get the average

int count=0;

// this if is to prevent any error if user does not provide any number

if(myinput == ""){

cout<< "Nothing entered";

return 0;

}

// while loop iterates up to total inputed numbers entered by user

while (stringS >> num) {

sum += num;

count++;

}

// Output the desired result

cout << "Sum :"<<sum << "\n";

cout << "Average :" << sum/count <<endl;

return 0;

}

You might be interested in
In Shoreville, the last low tide was at 12:00 a.m. About what time will the next high tide occur?
Oliga [24]
6 pm they happen every 12 hours

4 0
3 years ago
Read 2 more answers
The fill command try’s to fill or generate content for cells based on a ________.
natta225 [31]

Answer: Ctrl + R

Explanation:

Ctrl+ R is the shortcut for filling right, you will first highlight cells.

5 0
3 years ago
What should be done with equipment that is at the end of its life cycle and that is being donated to a charity?
Solnce55 [7]

Answer: C) Sanitize it

Explanation:

The system and equipment needs sanitization when it reach at the end of the life cycle and must ensure that they does not included any type of the sensitive data. As, sanitization is the process of remove and destroy all the data store in the memory device.    

Removing CD and DVDs is also the part in sanitation but many other element such as disk drive needs to be checked to ensure that they does not contain any type of information or data.

Removing all the software license and installing the original software, they both are not necessary require in the sanitization process.

Therefore, Option (C) is correct.

7 0
4 years ago
Suppose that outFileis an ofstreamvariable and output is to be stored in the file outputData.out. Which of the following stateme
BlackZzzverrR [31]

Answer:

Option b outFile.open("outputData.out");

Explanation:

In C++, there are several classes given to handle output and input of characters to or from files. They are:

  • ofstream that write on files
  • ifstream that read from files

We can use an object of ofstream to hold the contents that we wish to output to an external file. The general syntax is as follows:

           ofstream_obj.open(file_name)

This will create a file with a specific file name and it possesses all the contents from the obstream_obj.

5 0
3 years ago
__init__(self, features, phones): create/initialize instance variables for features and the list of phones (optional) in the pla
vredina [299]

Answer:

class Phone(object):

   def __init__(self, features, phones=[]):

       self.features = features

       self.phones = phones

Explanation:

In python object-oriented programming, an instance variable of a class object is created in the "__init__()" method. the "self" is a convention name used to represent the instance of an object class. The input values are assigned to the object variable with the self.'argument_name' statement.

When the phone argument is not given, the self.phones variable is initialized as an empty list.  

8 0
3 years ago
Other questions:
  • A ______________ is a document created when planning resource management to help promote teamwork and clarify team communication
    13·1 answer
  • A _____ is a group of two or more devices/computers connected together to allow for the exchange and information and for the sha
    5·2 answers
  • How does acceleration differ from velocity?
    15·1 answer
  • What is a secondary storage medium that uses magnetic techniques to store and retrieve data on disks or tapes coated with magnet
    6·1 answer
  • What is the value of alpha[3] after the following code executes?
    6·1 answer
  • The mouse pointer becomes different shapes depending on the pointer s location and locations you click on the screen. true false
    6·1 answer
  • Please Help me no links.
    6·1 answer
  • Which of the following is true about media production? A. All media elements contain a certain type of editorial viewpoint. B. P
    10·1 answer
  • What is computer software? How do you classify them?​
    8·2 answers
  • The USGS and National Weather Service have many sensors collecting data about natural events.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!