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
Sonja [21]
4 years ago
10

Write a function called pyramid(height) that acceptsa parameter ""height"". It then prints a pyramid of that height

Engineering
1 answer:
vichka [17]4 years ago
5 0

Answer:

I am writing a function in C++                              

Explanation:

<h2>C++ program</h2>

#include <iostream>

using namespace std;

int pyramid(int height) // function pyramid with parameter height

{int distance; //variable for spaces

   for(int i = 1, j = 0; i <= height; ++i, j= 0)  //handle the rows

   {

for(distance= 1; distance<= height-i; ++distance)

// handles the spaces & columns

    { cout <<"  ";        } //prints spaces between stars

       while(j!= 2*i-1)  //handles shape and spaces

       {   cout << "* "; // printing stars

           ++j;        }

       cout << '\n';    }   } // for the next line

int main()

{

int height; //declare height variable

cout <<"Enter height of pyramid "; //asks user to enter height of pyramid

cin>>height; //stores value of height

pyramid(height); //calls pyramid function

}

You might be interested in
In ________ programming, the programming is centered on objects that are created from abstract data types that encapsulate data
Contact [7]

Answer:

<em>Object-oriented</em>

Explanation:

<em>Object Oriented programming</em> <em>(OOP)</em> is a specific way of programming, where the code is organized in units called classes, from which objects are created that are related to each other to achieve the objectives of the applications. Object-oriented programming took over as the dominant programming style in the mid-1980s, largely due to the influence of C ++. Its dominance was consolidated thanks to the rise of graphical user interfaces, for which object-oriented programming is particularly well suited. Its most important characteristics are the following:

  • Encapsulation
  • Polymorphism
  • Abstraction
  • Inheritance

8 0
3 years ago
EnQueue(X): Thêm phần tử X vào Queue
irina [24]
Yes that is right no matter what you are talking about I’m not sure tho
6 0
3 years ago
A closed, rigid, 0.45 m^3 tank is filled with 12 kg of water. The initial pressure is p1 = 20 bar. The water is cooled until the
liberstina [14]

Answer:

initial quality = 0.3690

heat transfer = 979.63 kJ/kg

Explanation:

Given data:

volume of tank 0.45^3

weight of water 12 kg

Initial pressure 20 bar

final pressure 4 bar

Specific volume v = \frac {0.45}{12} = 0.0375 m^3/kg

At Pressure = 20 bar, from saturated water table

v_f = 0.01177 m^/kg

v_g = 0.099587 m^3/kg

x = \frac{v -v_f}{v_g -v_f} = \frac{0.0375 - 0.001177}{0.099587 - 0.001177}

inital quality is x =0.3690

Heat transfer is calculated as

u_1 = h_f + x(h_g - h_f) = v_f + x( h_{fg})

from saturated water table, for pressure 20 bar ,

h_f = 908.79 kJ/kg, h_{fg} = 1890.7 kJ/kg

     =908.79 + 0.0357(1890.7)

      = 979.63 kJ/kg

7 0
3 years ago
If you deposit today 11,613 in an account earning 8% compound interest, for how long should you invest the money in order to ear
Elanso [62]
Y = a (b)^t/p

y is total money

a is original amount

b is growth / decay factor

t is time

p is the frequency of every growth or decay

15131.76 = 11613 x 1.08^x

15131.76 / 11613 = 1.08^x

1.303… = 1.08^x

log1.303…. = xlog1.08

x = 3.43902165741 years
3 0
3 years ago
Consider the following Boolean function: F = xy’z + x’y’z + w’xy + wx’y + wxy
Doss [256]

Answer:

Explanation:

A.)

You just pick values for x, y and z, then work out F for each case. Since you have four variables, the values for x, y and z in your table will be as follows:

w x y z

0 0 0 0

0 0 0 1

0 0 1 0

0 0 1 1

0 1 0 0

0 1 0 1

0 1 1 0

0 1 1 1

1 0 0 0

1 0 0 1

1 0 1 0

1 0 1 1

1 1 0 0

1 1 0 1

1 1 1 0

1 1 1 1

Now just work out F for each case. It would be helpful to add a few extra coloumns since that's a pretty big equation. Here's how I would do it (notice the titles of the columns. I've worked out the first two for you to help you understand)

w | x | y | z | xy'z | x?y?z | w?xy | wx?y | wxy | F

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0

0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1

B.)

Cheack attachment for table

C.)

F = xy'z + x'y'z + w'xy + wx'y + wxy

F = (x+x')(y'z) + w'xy + (x+x')(wy)

F = y'z + w'xy + wy

F = y'z + y(w'x + w)

F = y'z + y(w + x)

F = y'z + wy + xy

D)

Logic Circuits, Boolean Algebra, and Truth Tables

: Truth Tables

A truth table is a chart of 1s and 0s arranged to indicate the results (or outputs) of all possible inputs. The list of all possible inputs are arranged in columns on the left and the resulting outputs are listed in columns on the right. There are 2 to the power n possible states (or combination of inputs). For example with three inputs there are 2^3=8 possible combination of inputs.  (Audio)

E)

: Logic Diagram

A logic diagram uses the pictoral description of logic gates in combination to represent a logic expression. An example below shows a logic diagram with three inputs (A, B, and C) and one output (Y). The interpretation of this will become clear in the following sections.

4 0
3 years ago
Other questions:
  • Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per li
    15·1 answer
  • In a hydroelectric power plant, water enters the turbine nozzles at 780 kPa absolute with a low velocity. If the nozzle outlets
    11·1 answer
  • What does the branch of physics include
    13·1 answer
  • What are the complex structures and the advantages and disadvantages
    6·1 answer
  • What are some goals of NYFEA? Select three options.
    9·2 answers
  • How do you solve this. I dont know how so I need steps if you dont mind
    13·1 answer
  • ⚠️I MARK BRAINLIST I AM BRING TIMED PIC INCLUDED⚠️Match the stage of the product development life cycle to the product that best
    6·1 answer
  • A heating torch is usually referred to as what?<br><br> Stick<br> Flower<br> Rose-bud<br> Lighter
    15·2 answers
  • Why is it better for a CPU to have more than one cache?
    8·1 answer
  • If a bearing needs 4. 0 s to solidify enough for impact, how high must the tower be?.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!