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 the resultant force on one side of a 25cm diameter circular plate standing at the bottom of 3m of pool water?
Tom [10]

Answer:

F=1.47 KN

Explanation:

Given that

Diameter of plate = 25 cm

Height of pool h = 3 m

We know that force can be given as

F= P x A

P=ρ x g x h

Now by putting the values

P=1000 x 10 x 3

P= 30 KPa

A=\dfrac{\pi}{4}\times 0.25^2\ m^2

A=0.049\ m^2

F= 30 x 0.049 KN

F=1.47 KN

So the force on the plate will be 1.47 KN.

4 0
3 years ago
joe is an exceptional systems engineer who hopes to work at the techtonic group. he is handicapped and uses a wheelchair. techto
ASHA 777 [7]

The HR department should install wheelchair ramps and widen the doorways as they don't want to loose an exceptional systems engineer who hopes to work at the techtonic group.

What is a wheelchair ramps?

A wheelchair ramp is an inclined plane that can be installed in addition to or instead of stairs. Ramps make it easier for wheelchair users, as well as people pushing strollers, carts, or other wheeled objects, to enter a building.

The Americans with Disabilities Act requires wheelchair ramps (or other ways for wheelchair users to access a building, such as a wheelchair lift) in new construction for public accommodations in the United States.

A wheelchair ramp can be fixed, semi-fixed, or portable. Permanent ramps are intended to be bolted or otherwise attached to the ground. Semi-permanent ramps are commonly used in the short term and rest on top of the ground or concrete pad.

To know more about wheelchair ramps, visit: brainly.com/question/17395685

#SPJ4

5 0
1 year ago
Problem 7.16 (GO Tutorial) A cylindrical bar of steel 10.4 mm (0.4094 in.) in diameter is to be deformed elastically by applicat
shepuryov [24]

Answer:

P = 18035.25 N

Explanation:

Given

D = 10.4 mm

ΔD = 3.2 ×10⁻³ mm

E = 207 GPa

ν = 0.30

If

σ = P/A

A = 0.25*π*D²

σ = E*εx

ν = - εz / εx

εz = ΔD / D

We can get εx as follows

εz = ΔD / D = 3.2 ×10⁻³ mm / 10.4 mm = 3.0769*10⁻⁴

Now we find εx

ν = - εz / εx   ⇒   εx = - εz / ν = - 3.0769*10⁻⁴ / 0.30 = - 1.0256*10⁻³

then

σ = E*εz = (207 GPa)*(-1.0256*10⁻³) = - 2.123*10⁸ Pa

we have to obtain A:

A = 0.25*π*D² = 0.25*π*(10.4*10⁻3)² = 8.49*10⁻⁵ m²

Finally we apply the following equation in order o get P

σ = P/A   ⇒  P =  σ*A = (- 2.123*10⁸Pa)*(8.49*10⁻⁵ m²) = 18035.25 N

4 0
3 years ago
1<br> Create an example of a positive correlation
BlackZzzverrR [31]

Answer:

fhv

Explanation:

gjf

5 0
3 years ago
Read 2 more answers
A(n) _____ is done to test each individual component (often a program) to ensure that it is as defect-free as possible.
lyudmila [28]

Answer:

Unit test

Explanation:

Defintion: A test of each individual component (often a program) to ensure that it is as defect-free as possible.

6 0
2 years ago
Other questions:
  • "From the earth to the moon". In Jules Verne’s 1865 story with this title, three men went to the moon in a shell fired from a gi
    5·1 answer
  • Use the convolutional integral to find the response of an LTI system with impulse response ℎ(????) and input x(????). Sketch the
    8·1 answer
  • 4.71 A full-wave rectifier circuit with a 1-kΩ operates from a 120-V (rms) 60-Hz household supply through a 6-to-1 transformer h
    10·1 answer
  • A PV battery system has an end-to-end efficiency of 77%. The system is used to run an all-AC load that is run only at night. The
    11·1 answer
  • Explain the difference in the heat transfer modes of conduction and convection.
    14·1 answer
  • The attached program (studentsGpa.cpp) uses dynamic allocation to create an array of strings. It asks the user to enter a number
    10·1 answer
  • The following median grain size data were obtained during isothermal liquid phase sintering of an 82W-8Mo-8Ni-2Fe alloy. What is
    15·1 answer
  • A(n) ____ is an exact representation of an object projected onto a plane from a specific position.
    14·1 answer
  • You are hired as the investigators to identify the root cause and describe what should have occurred based on the following info
    9·1 answer
  • On the pavement indicate that the adjacent lane is traveling in the same direction and passing is permitted
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!