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
Bas_tet [7]
3 years ago
8

Assume the following variable definition appears in a program:

Computers and Technology
1 answer:
AnnZ [28]3 years ago
4 0

Answer:

cout << setprecision(2)<< fixed << number;

Explanation:

The above statement returns 12.35 as output

Though, the statement can be split to multiple statements; but the question requires the use of a cout statement.

The statement starts by setting precision to 2 using setprecision(2)

This is immediately followed by the fixed manipulator;

The essence of the fixed manipulator is to ensure that the number returns 2 digits after the decimal point;

Using only setprecision(2) in the cout statement will on return the 2 digits (12) before the decimal point.

The fixed manipulator is then followed by the variable to be printed.

See code snippet below

<em>#include <iostream>  </em>

<em>#include <iomanip> </em>

<em>using namespace std;  </em>

<em>int main()  </em>

<em>{  </em>

<em> // Initializing the double value</em>

<em> double number = 12.3456;  </em>

<em> //Print  result</em>

<em> cout << setprecision(2)<< fixed << number;  </em>

<em> return 0;  </em>

<em>}  </em>

<em />

You might be interested in
A sinewave has a period (duration of one cycle) of 645 μs. What is the corresponding frequency of this sinewave, in kHz, express
irga5000 [103]

The corresponding frequency of this sinewave, in kHz, expressed to 3 significant figures is: <em>155 kHz.</em>

<u>Given the following data:</u>

  • Period = 645 μs

Note: μs represents microseconds.

<u>Conversion:</u>

1 μs = 1 × 10^{-6} seconds

645 μs = 645 × 10^{-6} seconds

To find corresponding frequency of this sinewave, in kHz;

Mathematically, the frequency of a waveform is calculated by using the formula;

Frequency = \frac{1}{Period}

Substituting the value into the formula, we have;

Frequency = \frac{1}{645\; * \;10^{-6}}

Frequency = 1550.39 Hz

Next, we would convert the value of frequency in hertz (Hz) to Kilohertz (kHz);

<u>Conversion:</u>

1 hertz = 0.001 kilohertz

1550.3876 hertz = X kilohertz

Cross-multiplying, we have;

X = 0.001 × 1550.39

X = 155039 kHz

To 3 significant figures;

<em>Frequency = 155 kHz</em>

Find more information: brainly.com/question/23460034

5 0
3 years ago
How should tools be stored <br>​
sweet-ann [11.9K]
You should store tools in a storage or tool box
4 0
3 years ago
12. In 2009, __________ of all pedestrian fatalities were caused by impaired drivers
makvit [3.9K]
3% of pedestrian fatalities were caused by impaired drivers  
4 0
3 years ago
Read 2 more answers
You want to know your grade in Computer Science, so write a program that continuously takes grades between 0 and 100 to standard
Dominik [7]

Answer:

Following are the program in the Python Programming Language.

#declare variables and initialize to 0

s=0

n=0

avg=0

#set the infinite while loop  

while(True):

 #get input from the user

 score=input()

 #set if statement to break loop

 if(score =="stop"):

   break

 #otherwise, perform calculation

 else:  

   n+= 1

   s=s+ int(score)

   avg= s/n

#print average of the input

print ('average: ',avg)

<u>Output</u>:

58

96

34

15

stop

average:  50.75

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, set three variable that is 's' for sum, 'n' for count and 'avg' for average and initialize them to 0.
  • Set the infinite while loop and inside it, set variable 'score' that get input from the user then, set the if conditional statement for break the loop, otherwise we calculate the sum of the user input and calculate its average.
  • Finally, we print the result with message.
6 0
3 years ago
Why are computer messages encapsulated?
Tcecarenko [31]

Answer:

I think the answer is to translate messages from one machine’s programming language into another

Explanation:

6 0
3 years ago
Other questions:
  • video-sharing sotes such as youtube and vimeo provide a place to post short videos called clips true or false?
    5·1 answer
  • Name one advantage of modular switches over fixed-configuration switches.
    5·1 answer
  • Henry created a software that manages all of his music. He wishes to run software on another computer system that runs an operat
    8·1 answer
  • Does inline-block means it makes the block element inline?
    15·1 answer
  • Why do most employers encourage their workers to invest in 401(k) accounts? (Site 1)
    14·2 answers
  • Write a function named joinStrings() that keeps asking the user for words and joins them together. Each word should start with a
    12·1 answer
  • Which marketing claim do you see on the opening screen of the new words with friends
    14·1 answer
  • Electronic cover letters are longer than traditional paper cover letters.
    13·2 answers
  • When can design templates be applied to the presentation?
    5·1 answer
  • What is science worksheet answers name the three features that make science different from other human endeavors?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!