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]
3 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]3 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
Write a program that uses the function isPalindrome given below. Test your program on the following strings: madam, abba, 22, 67
defon

Answer:

#include <iostream>

#include <string>

using namespace std;

bool isPalindrome(string str)

{

   int length = str.length();

   for (int i = 0; i < length / 2; i++)

   {

       if (tolower(str[i]) != tolower(str[length - 1 - i]))

           return false;

   }

   return true;

}

int main()

{

   string s[6] = {"madam", "abba", "22", "67876", "444244", "trymeuemyrt"};

   int i;

   for(i=0; i<6; i++)

   {

       //Testing function

       if(isPalindrome(s[i]))

       {

           cout << "\n " << s[i] << " is a palindrome... \n";

       }

       else

       {

           cout << "\n " << s[i] << " is not a palindrome... \n";

       }

   }    

       

   return 0;

}

5 0
2 years ago
Hey friends.... ajao bat Kare ✌️✌️❤️​
Dvinal [7]

dude thx for the points lol

4 0
2 years ago
Read 2 more answers
Determine the required dimensions of a column with a square cross section to carry an axial compressive load of 6500 lb if its l
ycow [4]

Answer: 0.95 inches

Explanation:

A direct load on a column is considered or referred to as an axial compressive load. A direct concentric load is considered axial. If the load is off center it is termed eccentric and is no longer axially applied.

The length= 64 inches

Ends are fixed Le= 64/2 = 32 inches

Factor Of Safety (FOS) = 3. 0

E= 10.6× 10^6 ps

σy= 4000ps

The square cross-section= ia^4/12

PE= π^2EI/Le^2

6500= 3.142^2 × 10^6 × a^4/12×32^2

a^4= 0.81 => a=0.81 inches => a=0.95 inches

Given σy= 4000ps

σallowable= σy/3= 40000/3= 13333. 33psi

Load acting= 6500

Area= a^2= 0.95 ×0.95= 0.9025

σactual=6500/0.9025

σ actual < σallowable

The dimension a= 0.95 inches

3 0
2 years ago
Read 2 more answers
If you were to plot the voltage versus the current for a given circuit, what would you expect the slope of the line to be? If no
Brut [27]

Answer:

Part 1: It would be a straight line, current will be directly proportional to the voltage.

Part 2: The current would taper off and will have negligible increase after the voltage  reaches a certain  value. Graph attached.

Explanation:

For the first part, voltage and current have a linear relationship as dictated by the Ohm's law.

V=I*R

where V is the voltage, I is the current, and R is the resistance. As the Voltage increase, current is bound to increase too, given that the resistance remains constant.

In the second part, resistance is not constant. As an element heats up, it consumes more current because the free sea of electrons inside are moving more rapidly, disrupting the flow of charge. So, as the voltage increase, the current does increase, but so does the resistance. Leaving less room for the current to increase. This rise in temperature is shown in the graph attached, as current tapers.

7 0
3 years ago
If 5000 N of thrust is acting to the left, and 4300 N of drag is acting to the right, what is the magnitude and direction of the
Kipish [7]

Answer:

700 N acting to the left.

8 0
3 years ago
Other questions:
  • With reference to the NSPE Code of Ethics, which one of the following statements is true regarding the ethical obligations of th
    15·1 answer
  • A market research survey has 15 questions and will be sent to 500 people. What is the total cost to conduct survey if it has a $
    12·1 answer
  • You are given a partial implementation of one header file, GildedRose.hpp. Item is a class that holds the information for each i
    6·1 answer
  • What is a quasi-equilibrium process? What is its importance in engineering?
    14·1 answer
  • Write a program that asks the user to enter a list of numbers. The program should take the list of numbers and add only those nu
    7·1 answer
  • Which of the following activities can help expand engineers' creative thinking capabilities?
    11·2 answers
  • An engine jack is used to lift a 265-lb engine 6'. How much work, in ft-lb, is performed?
    11·1 answer
  • A torque T 5 3 kN ? m is applied to the solid bronze cylinder shown. Determine (a) the maximum shearing stress, (b) the shethe 1
    10·1 answer
  • Which organization would provide business and leadership training to a high school hospitality student?
    6·1 answer
  • Why do giant stars become planetary nebulas while supergiant stars become supernovas when their nuclear fusion slows and is over
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!