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
Lynx eat snowshoe hares, and snowshoes hears eat plants. Which term can be applied to the lynx in this food chain example? Prima
erastova [34]

Answer:

primary consumer because YES

3 0
2 years ago
Scheduling can best be defined as the process used to determine:​
shutvik [7]

Answer:

Overall project duration

Explanation:

Scheduling can best be defined as the process used to determine a overall project duration.

8 0
2 years ago
Compute L, T, M, LC, and R and stations of the BC and EC for the circular curve with the given data of: I (delta) = 22°15′00" an
Mars2501 [29]

Answer:

L = 475.718

T = 240.89 ft

M = 23.0195

LC = 472.728

R = 1225 ft

Explanation:

See the attached file for the calculation.

8 0
2 years ago
Which of the following explains the main reason to cut a piece of wood on the outside of the measurement mark?
maks197457 [2]
I think it’s D ?? I’m not completely sure tho
4 0
3 years ago
An angle grinder is best suited for use with which material?.
Kaylis [27]

Answer:

Angle grinders are used mostly for copper, iron, steel, lead, and other metals.

Explanation:

I hope it helps! Have a great day!

Lilac~

4 0
2 years ago
Other questions:
  • A 300 mm long steel bar with a square cross section (25 mm per edge) is pulled in tension with a load of 83,051 N , and experien
    10·1 answer
  • A 3.5-m3 rigid tank initially contains air whose density is 2 kg/m3 . The tank is connected to a high-pressure supply line throu
    8·1 answer
  • A cylindrical bar of steel 10.1 mm (0.3976 in.) in diameter is to be deformed elastically by application of a force along the ba
    15·1 answer
  • The flatbed truck carries a large section of circular pipe secured only by the two fixed blocks A and B of height h. The truck i
    14·2 answers
  • Someone claims that the shear stress at the center of a circular pipe during fully developed laminar flow is zero. Do you agree
    12·1 answer
  • The Greek alphabet has 24 distinct lowercase letters. How many bits are needed to be able to encode any single lowercase Greek l
    9·1 answer
  • Create a document that includes a constructor function named Company in the document head area. Include four properties in the C
    7·1 answer
  • You don't know which insert you have, and the inserts are different sizes, meaning the amount needed for a 1:3 ratio is differen
    13·1 answer
  • Two engineers are discussing the various merits of hydroelectricity. Engineer A says that tidal barrage systems can generate ele
    6·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!