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
A square isothermal chip is of width w 5 mm on a side and is mounted in a substrate such that its side and back surfaces are wel
Lynna [10]

Answer:

a) 0.35 W

b) 5.25 W

Explanation:

Given that

Width of the chip, W = 5 mm

The environment temperature, T(∞) = 15° C

Surface temperature, T(s) = 85° C

The initial convection heat coefficient, h1 = 200 W/m².K

The final convection heat coefficient, h2 = 3000 W/m².K

See attachment for solution

6 0
3 years ago
Question 5
likoan [24]

Answer:

worth of being noticed

Explanation:

i had this in iready it’s correct trust me

8 0
3 years ago
Read 2 more answers
In fully developed laminar flow in a circular pipe the velocity at R/2 (mid-way between the wall surface and the centerline) is
Butoxors [25]

Answer:

u_{max} = 17.334\,\frac{m}{s}

Explanation:

Let consider that velocity profile inside the circular pipe is:

u(r) = 2\cdot U_{avg} \cdot \left(1 - \frac{r^{2}}{R^{2}}  \right)

The average speed at r = \frac{1}{2} \cdot R is:

U_{avg} = \frac{13\,\frac{m}{s} }{2\cdot \left(1-\frac{1}{4}  \right)}

U_{avg} = 8.667\,\frac{m}{s}

The velocity at the center of the pipe is:

u_{max} = 2\cdot U_{avg}

u_{max} = 17.334\,\frac{m}{s}

6 0
3 years ago
Read 2 more answers
An astronomer of 65 kg of mass hikes from the beach to the observatory atop the mountain in Mauna Kea, Hawaii (altitude of 4205
lara [203]

Answer:

0.845\ \text{N}

Explanation:

g = Acceleration due to gravity at sea level = 9.81\ \text{m/s}^2

R = Radius of Earth = 6371000 m

h = Altitude of observatory = 4205 m

Change in acceleration due to gravity due to change in altitude is given by

g_h=g(1+\dfrac{h}{R})^{-2}\\\Rightarrow g_h=9.81\times(1+\dfrac{4205}{6371000})^{-2}\\\Rightarrow g_h=9.797\ \text{m/s}^2

Weight at sea level

W=mg\\\Rightarrow W=65\times 9.81\\\Rightarrow W=637.65\ \text{N}

Weight at the given height

W_h=mg_h\\\Rightarrow W_h=65\times 9.797\\\Rightarrow W_h=636.805\ \text{N}

Change in weight W_h-W=636.805-637.65=-0.845\ \text{N}

Her weight reduces by 0.845\ \text{N}.

8 0
3 years ago
A(n)<br> is a safety device commonly<br> used with a slotted nut.
liraira [26]

A safety device called a cotter pin. The cotter pin fits through a hole in the bolt or part. This keeps the nut from turning and possibly coming off.

5 0
3 years ago
Other questions:
  • R 134a enters a air to fluid heat exchanger at 700 kPa and 50 oC. Air is circulated into the heat exchanger to cool the R134a to
    6·1 answer
  • What is the base unit in standard measurement
    13·2 answers
  • A car radiator is a cross-flow heat exchanger with both fluids unmixed. Water, which has a flow rate of 0.05 kg/s, enters the ra
    15·1 answer
  • The conditions at the beginning of compression in an Otto engine operating on hot-air standard with k=1.35 and 101.325 kPa, 0.05
    10·1 answer
  • A block of mass 0.75 kg is suspended from a spring having a stiffness of 150 N/m. The block is displaced downwards from its equi
    5·2 answers
  • How long does it take electrons to get from a car battery to the starting motor? Assume the current is 300 A and the electrons t
    10·1 answer
  • How did humans create a space suit without ever going. How did we know spaces conditions?
    5·2 answers
  • Somebody help me!! It’s due today
    9·1 answer
  • 9. An automobile's oxygen sensor output needs
    14·1 answer
  • A sprinter reaches his maximum speed in 2.5sec from rest with constant acceleration. He then maintains that speed and finishes t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!