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
)what item is at the front of the list after these statements are executed?
White raven [17]

Answer:

Option (a) : sam

Explanation:

  • In the given program, the queue is defined in the first step.
  • The method addToFront() adds the given element to the front of the queue. After this step is executed the front element in the queue is that element.
  • The method addToBack() adds the given element to the back of the queue. After this step is executed the back element in the queue is that element.
  • After step 1, Jack is added to the front of the queue.
  • After step 2, Rudy is added to the back of the queue.
  • After step 3, Larry is added to the back of the queue.
  • After step 4, sam is added to the front of the queue.
  • After step 5, name contains Larry as the getBack() returns the element present at the back of the queue.
  • After step 6, Adam is added to the back of the queue.
  • After executing all of the steps now the queue contains "sam" as the front element of the queue.
  • So, the correct option is "sam".
3 0
3 years ago
Which of the following is NOT true about variables?
VikaD [51]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The value stored by a variable can be changed after it is assigned(true).

The value of a variable can be changed after it is assigned, for example:

int a=10;

and we can change the value of variable a in letter program such as:

a=15;

Variables are a name for a spot in the computer's memory (true).

it is true, because the variables value stored in the computer's memory and we can access theses values by their name (variable name). so Variables are a name for a spot in the computer's memory.

Variable names can be words: such as temperature or height (true).

Yes, the variable name can be words such as height, width, temperature etc.

The value stored by a variable cannot be changed after it is assigned (false).

It is noted that the value stored by a variable can be changed after it is assigned. However, it is noted that is some programming language, you can't change the value of static variable.

3 0
4 years ago
FS EVERFI:
Snowcat [4.5K]

Answer:

A) work study program

Explanation:

Because you need experience and scholarships don't always pay, so this is the best choice.

6 0
2 years ago
Read 2 more answers
Which security risk is an example of malware?
marshall27 [118]
Viruses, worms, ransomware, spyware and trojan horses. These are some answers 
3 0
4 years ago
Read 2 more answers
Which Boolean operator enables you to exclude a search term?
Lisa [10]

It is letter D. but i might be incorrect, please contact your teacher for further information. sorry if I got your answer wrong... :(

4 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is the part of a digital camera that acts as the film?
    11·1 answer
  • Which phase takes all the detailed design documents from the design phase and transforms them into the actual system? Testing ph
    7·1 answer
  • A TCP entity opens a connection and uses slow start. Approximately how many round-trip times are required before TCP can send N
    11·1 answer
  • Carol typed a memo to distribute to everyone in her department. To create this memo, she used a _____. spreadsheet word processo
    8·2 answers
  • You are trying to connecting your laptop to your new 52" LED TV using an HDMI connector. When you connect everything, you immedi
    15·1 answer
  • What alternative to leased lines is used by VPNs? As an alternative to leased lines, VPNs use ______ connections.
    11·1 answer
  • Explain agile testing ​
    11·1 answer
  • Question 11
    9·1 answer
  • What happens when an arithmetic operator is applied to non-arithmetic data types such as Boolean or character
    7·1 answer
  • quizlet ann is a security professional for a midsize business and typically handles log analysis and security monitoring tasks f
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!