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

Read a 4 character number. Output the result in in the following format, Input 9873, Output 3 *** 7 ******* 8 ******** 9 *******

** If one of the numbers is not a digit, then put a ? mark Input = 98a3, Output 3 *** a ? 8 ******** 9 ********* Prompt the user before the input with, cout<<"Create a histogram chart."<
Engineering
1 answer:
Rus_ich [418]3 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main()

{

 char numbers[4];

 

 cout<<"Create a histogram chart."<<endl;

 cout<<"Enter your number as 4 characters: ";

 

 cin >> numbers;

 

 for (int i=3; i>=0; i--) {

   int ascii_value = numbers[i];

   int number = numbers[i] - '0';

   

   if (ascii_value >=48 && ascii_value <=57) {

       cout << number;

       

       for (int j=number-1; j>=0; j--) {

           cout << "*";    

       }

   }

   else {

       cout << "a ?";    

   }

   

   cout << endl;

 }

}



Explanation:

Declare a character array with length 4,

Ask user to enter values,

Create a nested for loop; first loop <u>holds the values and their ASCII values for each character</u>,

<u>Check the ASCII values</u> for each character, if they are <u>between 48 and 57</u>, that means they are numbers. In this case, print the number and go to the inner loop and print the stars accordingly,

If ASCII values are not in the range, print a ?,

Go to the new line after each character

You might be interested in
Consider a simple ideal Rankine cycle and an ideal regenerative Rankine cycle with one open feedwater heater. The two cycles are
borishaifa [10]

Answer:

They both have the same efficiency.

Explanation:

The simple ideal Rankine cycle and an ideal regenerative Rankine cycle with one open feedwater heater would both have the same efficiency because the extraction steam would just create a mini cycle that recirculates. The energy given to the feedwater heater is proportional to the added heat in the boiler to the feedwater in the simple cycle to raise its temperature to the same boiler inlet condition.

Therefore in comparison, the efficiency is the same for both.

4 0
3 years ago
(20pts) Air T[infinity] = 10 °C and u[infinity] = 100 m/s flows over a flat plate. Assume that the density of air is 1.0 kg/m3 a
miskamm [114]

Answer:

attached below

Explanation:

8 0
3 years ago
What is the primary water source for a water cooled recovery unit's condensing coll?
nataly862011 [7]
A) chilled water from evaporator
7 0
3 years ago
A 20.0 µF capacitor is charged to a potential difference of 800 V. The terminals of the charged capacitor are then connected to
Sergeu [11.5K]

Answer:

a) Q_initial = 16 * 10^-3 C

b) V_1 = V_2 =  (16/3) * 10^2 V

c)  E = 64/15 J

d)  dE = 32/15 J of decrease

Explanation:

Given:

- Capacitor 1, C_1 = 20.0 uF

- Capacitor 2, C_2 = 10.0 uF

- Charged with P.d V = 800 V

Find:

a) the original charge of the system,

(b) the final potential difference across each capacitor

(c) the final energy of the system

(d) the decrease in energy when the capacitors are connected.

Solution:

a)

- The initial charge in the circuit is the one carried by the first charged capacitor.

                           Q_initial = C_1*V

                           Q_initial = 20*10^-6 * 800

                           Q_initial = 16 * 10^-3 C

b)

- After charging the other capacitor, we know that the total charge is conserved among two capacitor:

                          Q_initial = Q_1 + Q_2

- We also know that potential difference across two capacitor is also same.

                          V_1 = V_2 = Q_1 / C_1 = Q_2 / C_2

- Using the two equations and solve for charge Q_2:

                          Q_2 = Q_1*C_2/C_1

                          Q_2 = Q_1*10/20 = 0.5*Q_1

- using conservation of charge:

                          Q_initial = 1.5*Q_1

                          Q_1 = 16*10^-3 / 1.5 = 10.67*10^-3 C

- Hence the Voltage across each capacitor is:

                          V_2 = V_1 = Q_1 / C_1  

                                            = 10.67*10^-3 / 20*10^-6

                                            = (16/3) * 10^2 V

c)

- The energy in the system is:

                          E = 0.5*C_eq*V^2

Where, C_eq is the equivalent capacitance of paralle circuit.

                           E = 0.5*(20+10)*10^-6 *((16/3) * 10^2)^2

                          E = 64/15 J

d)

- The decrease in energy of the capacitors is:

                           dE = E_initial - E_final

Where, E_initial is due to charging of the C_1 only:

                          dE = 0.5*10^-6*20*800^2 - (64/15)

                          dE = 32/5 - 64/15 = 32/15 J

5 0
3 years ago
A ____ is marked by two sets of double yellow lines, with each set having a broken line on the inside, and a solid line on the o
Vitek1552 [10]

Answer:

  center left-turn lane

Explanation:

A <em>center left turn lane</em> will be marked as described. The arrows, if present, generally indicate that left turns are permitted from the lane with these markings.

__

If the double yellow lines are solid, they are considered to be a "barrier" and are not to be crossed.

7 0
3 years ago
Read 2 more answers
Other questions:
  • A milling operation was used to remove a portion of a solid bar of square cross section. Forces of magnitude P = 18 kN are appli
    15·1 answer
  • Explain the difference in the heat transfer modes of conduction and convection.
    14·1 answer
  • Ear "popping" is an unpleasant phenomenon sometimes experienced when a change in pressure occurs, for example in a
    12·1 answer
  • ______________ help protect the lower legs and feet from heat hazards like molten metal and welding sparks. A) Safety shoesB) Le
    7·1 answer
  • If these components have weights WA = 50000 lb , WB=8000lb, and WC=6000lb, determine the normal reactions of the wheels D, E, an
    14·1 answer
  • which one of the following appliance parts gets the hardest services? A. Heating elementwhich one of the following appliance par
    10·2 answers
  • What is the following diagram called?
    15·1 answer
  • La Patrulla Fronteriza de los Estados Unidos analiza la compra de un helicóptero nuevo para la vigilancia aérea de la frontera d
    14·1 answer
  • You need to lower your lift onto the mechanical load-holding devices to provide structural support before working under the lift
    12·1 answer
  • An earth fill, when compacted will occupy a net volume of 187,000 cy. The borrow material that will be used to construct this fi
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!