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
What is a Flame Front Generator?
Inessa [10]

Answer and Explanation:

Flame Front Generator: It is a ignition system which is very useful in flaring system .In this system the air and gases are mixed together and make a combustible air gas mixture. There is a flame front region where the combustion reaction takes place , it is the region where gases as like hydrogen and air mixed with each other and form combustible gases.

7 0
3 years ago
The role of civil and structural engineer is to produce buildings for
Alinara [238K]
So I’m thinking C because they both have a lot to do with design here is my evidence. Structural engineering is a component of civil engineering which focuses on the design and development of infrastructures such as bridges, skyscrapers, dams. Civil engineering is a professional engineering discipline that deals with the design, construction, and maintenance of the physical and naturally built environment. I may be wrong but hope this helped!
3 0
2 years ago
A fisherman tries to escape a flash flood by walking up the 10 degree hill. If the water is rising at 0.11 m/s, how fast must he
FromTheMoon [43]

10.5 mph I’m pretty sure so so sorry if I’m wrong

6 0
3 years ago
Read 2 more answers
If the wire has a diameter of 0.6 in., determine how much it stretches when a distributed load of w=100lb/ft acts on the beam. T
pogonyaev

Answer:

Explanation:

e has a diameter of 0.6 in., determine how much it stretches when a distributed load of w=100lb/ft acts on the beam. The wire remains elastic. Use Est=29.0(103)ksi.

6 0
3 years ago
Briefly discuss the principle forms of communication that might be utilized in the construction industry?
e-lub [12.9K]

Answer:

xcvjchjcnjkkhjmklk heyyyy biiiiiiiittcccchhh

4 0
3 years ago
Other questions:
  • Teresa is emotionally volatile, particularly with friends and boyfriends. She is extremely dramatic about even the smallest disa
    15·1 answer
  • A composite wall consists of 20 mm thick steel plate backed by insulation brick (k = 0.39 W/mK) of 50 cm thickness and overlaid
    6·1 answer
  • A gear box’s shaft is made of a hollow circular steel tube with allowable yield stress equal to σa????????o???? . The shaft is l
    7·1 answer
  • Liquid flows at steady state at a rate of 2 lb/s through a pump, which operates to raise the elevation of the liquid 100 ft from
    6·1 answer
  • 5. A non-cold-worked brass specimen of average grain size 0.01 mm has a yield strength of 150 MPa. Estimate the yield strength o
    10·1 answer
  • At a point on the free surface of a stressed body, the normal stresses are 20 ksi (T) on a vertical plane and 30 ksi (C) on a ho
    7·1 answer
  • Create a program that calculates the monthly payments on a loan using Decimal &amp; LC Console SEE Sanple Run Attached Specifica
    14·1 answer
  • 3) What kind of bridges direct their load along it's curve and into the
    12·1 answer
  • Hot carbon dioxide exhaust gas at 1 atm is being cooled by flat plates. The gas at 220 °C flows in parallel over the upper and l
    15·1 answer
  • During a load test, a battery's voltage drops below a specific value. what action should the technician take?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!