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
For somebody
Brums [2.3K]

Answer:

Cool song

Explanation:

Ur hot also

4 0
3 years ago
Steam at 4 MPa and 350°C is expanded in an adiabatic turbine to 125kPa. What is the isentropic efficiency (percent) of this turb
guajiro [1.7K]

Answer:

\eta_{turbine} = 0.603 = 60.3\%

Explanation:

First, we will find actual properties at given inlet and outlet states by the use of steam tables:

AT INLET:

At 4MPa and 350°C, from the superheated table:

h₁ = 3093.3 KJ/kg

s₁ = 6.5843 KJ/kg.K

AT OUTLET:

At P₂ = 125 KPa and steam is saturated in  vapor state:

h₂ = h_{g\ at\ 125KPa} = 2684.9 KJ/kg

Now, for the isentropic enthalpy, we have:

P₂ = 125 KPa and s₂ = s₁ = 6.5843 KJ/kg.K

Since s₂ is less than s_g and greater than s_f at 125 KPa. Therefore, the steam is in a saturated mixture state. So:

x = \frac{s_2-s_f}{s_{fg}} \\\\x = \frac{6.5843\ KJ/kg.K - 1.3741\ KJ/kg.K}{5.91\ KJ/kg.K}\\\\x = 0.88

Now, we will find h_{2s}(enthalpy at the outlet for the isentropic process):

h_{2s} = h_{f\ at\ 125KPa}+xh_{fg\ at\ 125KPa}\\\\h_{2s} = 444.36\ KJ/kg + (0.88)(2240.6\ KJ/kg)\\h_{2s} = 2416.088\ KJ/kg

Now, the isentropic efficiency of the turbine can be given as follows:

\eta_{turbine} = \frac{h_1-h_2}{h_1-h_{2s}}\\\\\eta_{turbine} = \frac{3093.3\ KJ/kg-2684.9\ KJ/kg}{3093.3\ KJ/kg-2416.088\ KJ/kg}\\\\\eta_{turbine} = \frac{408.4\ KJ/kg}{677.212\ KJ/kg}\\\\\eta_{turbine} = 0.603 = 60.3\%

3 0
3 years ago
you are planning to buy a new couch for your family room you measure the available space and conclude that the couch should be b
nirvana33 [79]
5-6 feet is 60-72 inches and 8 feet is 96 inches
7 0
3 years ago
A rectangular region ABCD is to be built inside a semicircle of radius 10 m with points A and B on the line for the diameter and
Talja [164]

Answer:A rectangular region ABCD is to be built inside a semicircle of radius 10 m with points A and B on the line for the diameter and points C and D on the semicircle with CD parallel to AB. The objective is to find the height h * that maximizes the area of ABCD.

Formulate the optimization problem.

Explanation:A rectangular region ABCD is to be built inside a semicircle of radius 10 m with points A and B on the line for the diameter and points C and D on the semicircle with CD parallel to AB. The objective is to find the height h * that maximizes the area of ABCD.

Formulate the optimization problem.

7 0
3 years ago
The biggest advantage of sketches is that
steposvetlana [31]

Answer:

They communicate ideas very quickly.

Explanation:

8 0
3 years ago
Other questions:
  • The popularity of orange juice, especially as a breakfast drink, makes it an important factor in the economy of orange-growing r
    14·1 answer
  • Drag each tile to the correct box.
    15·1 answer
  • Barry wants to convert mechanical energy into electric energy. What can he use?
    5·2 answers
  • 1) Each of the following would be considered company-confidential except
    10·1 answer
  • 1. Springs____________<br> energy when compressed<br> And _________energy when they rebound.
    12·1 answer
  • How do i play Fortnite on controller?
    6·2 answers
  • Why do stores still sell those 1.5 volt batteries that are like three times the size of other 1.5 volt batteries. What is the po
    9·2 answers
  • The image shows the relative positions of Earth and the Sun for each of the four seasons. Earth travels in an elliptical orbit a
    11·2 answers
  • Quelles sont les types de carburant utilisés en aviation
    15·1 answer
  • Travel Planning or Destination Planning will help make your travel more efficient, and not necessary a risk reduction plan as yo
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!