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
Software that is released to have users test out the "bugs" is known as Ransomeware O Break-in software 2 O Flim flam software O
Sophie [7]

Answer:

Beta software

Explanation:

5 0
2 years ago
Are there engineering students here?​
leva [86]
Uh, I’d assume so because Brainly has a whole section of questions for them.
7 0
3 years ago
Read 2 more answers
Ordan has _ 5 8 can of green paint and _ 3 6 can of blue paint. If the cans are the same size, does Jordan have more green paint
Morgarella [4.7K]

Answer:

Jordan has more green paints

Explanation:

Given

Green = \frac{5}{8}

Blue = \frac{3}{6}

Required

Which paint does he have more?

For better understanding, it's better to convert both measurements to decimal.

For the green paint:

Green = \frac{5}{8}

Green = 0.625

For the blue paint:

Blue = \frac{3}{6}

Blue = 0.5

By comparison:

0.625 > 0.5

<em>This means that Jordan has more green paints</em>

3 0
3 years ago
An Ideal gas is being heated in a circular duct as while flowing over an electric heater of 130 kW. The diameter of duct is 500
Rashid [163]

Answer:

Exit temperature = 32 °C

Explanation:

We are given;

Initial Pressure;P1 = 100 KPa

Cp =1000 J/kg.K = 1 KJ/kg.k

R = 500 J/kg.K = 0.5 Kj/Kg.k

Initial temperature;T1 = 27°C = 273 + 27K = 300 K

volume flow rate;V' = 15 m³/s

W = 130 Kw

Q = 80 Kw

Using ideal gas equation,

PV' = m'RT

Where m' is mass flow rate.

Thus;making m' the subject, we have;

m' = PV'/RT

So at inlet,

m' = P1•V1'/(R•T1)

m' = (100 × 15)/(0.5 × 300)

m' = 10 kg/s

From steady flow energy equation, we know that;

m'•h1 + Q = m'h2 + W

Dividing through by m', we have;

h1 + Q/m' = h2 + W/m'

h = Cp•T

Thus,

Cp•T1 + Q/m' = Cp•T2 + W/m'

Plugging in the relevant values, we have;

(1*300) - (80/10) = (1*T2) - (130/10)

Q and M negative because heat is being lost.

300 - 8 + 13 = T2

T2 = 305 K = 305 - 273 °C = 32 °C

13000 + 300 - 8000 = T2

6 0
3 years ago
Two previously undeformed rod-shaped specimens of copper are to be plastically deformed by reducing their cross-sectional areas.
mezya [45]
I am not sure I am stuck on this and I have been for 45 min someone please help me and this girl or boy!!
4 0
3 years ago
Other questions:
  • Two mass streams of the same ideal gas are mixed in a steady-flow chamber while receiving energy by heat transfer from the surro
    11·1 answer
  • Calculate the reactions at 4 ends (supports) of this bookshelf. Assume that the weight of each book is approximately 1 lb. The w
    13·1 answer
  • Using the data from the table, what is P(3)?!
    9·1 answer
  • Consider a sphere made of stainless steel with diameter of 25 cm. It is heated to temperature of 300°C for some chemical tests.
    12·1 answer
  • A 20-mm thick draw batch furnace front is subjected to uniform heat flux on the inside surface, while the outside surface is sub
    15·1 answer
  • If a nurse does not agree to the discipline set due to a complaint made against this nurse, after reviewing the proposed agreed
    14·1 answer
  • The compression ratio of most small gasoline engines falls between_______and________.
    13·2 answers
  • Please help ill mark as brainlest
    13·1 answer
  • Lets Try This: study the pictures. Describe what you see and think about it. write your answer on a sheet of paper. home room
    15·1 answer
  • Precast concrete curtain wall panels: Group of answer choices are typically manufactured on site and then hoisted into place. of
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!