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
Examples of reciprocating motion in daily life
bonufazy [111]

Answer:

Examples of reciprocating motion in daily life are;

1) The needles of a sewing machine

2) Electric powered reciprocating saw blade

3) The motion of a manual tire pump

Explanation:

A reciprocating motion is a motion that consists of motion of a part in an upward and downwards (\updownarrow) or in a backward and forward (↔) direction repetitively

Examples of reciprocating motion in daily life includes the reciprocating motion of the needles of a sewing machine and the reciprocating motion of the reciprocating saw and the motion of a manual tire pump

In a sewing machine, a crank shaft in between a wheel and the needle transforms the rotary motion of the wheel into reciprocating motion of the needle.

8 0
2 years ago
Why is concrete on its own not a good material to use
Inga [223]

Answer:

It has poor tensile strength despite having high compressive strength

Explanation:

Concrete exhibits high compressive strength when used. However, it has very low compressive strength. This is the reason why concrete is normally combined with steel to make a composite building material called reinforced concrete. The steel reinforces concrete hence increasing the tensile strength in RC buildings. The end composite is durable and fireproof. Generally, the main reason why concrete is not use on its own is due to its poor tensile strength.

7 0
3 years ago
Match each context to the type of the law that is most suitable for it.
Bas_tet [7]

Answer:

sorry i dont understand the answer

Explanation:

but i think its a xd jk psml lol

5 0
3 years ago
Determine the nature of the following cycle (reversible, irreversible, or impossible): a refrigeration cycle draws heat from a c
vlabodo [156]

Answer:

Impossible.

Explanation:

The ideal Coefficient of Performance is:

COP_{i} = \frac{250\,K}{300\,K-250\,K}

COP_{i} = 5

The real Coefficient of Performance is:

COP_{r} = \frac{950\,kJ-70\,kJ}{70\,kJ}

COP_{r} = 12.571

Which leads to an absurds, since the real Coefficient of Performance must be equal to or lesser than ideal Coefficient of Performance. Then, the cycle is impossible, since it violates the Second Law of Thermodynamics.

6 0
3 years ago
A building wall has dimensions of 3 m tall and 10 m wide. It is constructed of 2 cm. wallboard (k = 0.5 W/m-C) on the inside, 3
Art [367]

Answer: heat loss through wall is 16.58034kW

Temperature of inside wall surface is 47°c

Temperature of outside wall surface is -2.7°c

Explanation:detailed calculation and explanation is shown in the image below.

4 0
3 years ago
Other questions:
  • Now, suppose that you have a balanced stereo signal in which the left and right channels have the same voltage amplitude, 500 mV
    8·1 answer
  • Question 5 (20 pts) The rated current of a three-phase transmission line is 300 A. The currents flowing by the line are measured
    6·1 answer
  • Problem 3: Soil Classification using the AASHTO and USCS Systems
    10·1 answer
  • What are the weight restrictions for a small UAS, including everything onboard at the time
    12·1 answer
  • WhT DO FILM PRODUTION SAY WHEN REMOVING GREEN AND BLUE SCREENS.
    14·1 answer
  • [10] Create a program called SelectionSort.java that implements the Selection Sort algorithm (The Art of Computer Programming -
    10·1 answer
  • After adjusting your seat, your___ should be as closest possible to the back rest.
    14·1 answer
  • What is meant by the acronym ISO
    15·1 answer
  • Does an electronic clock use electrical energy?​
    10·2 answers
  • How might a field like philosophy of history help scientists​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!