C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 5, Problem 5.21E
Program Plan Intro

Program Plan-

  • Include the header files and initialize the main() function.
  • Declare the function prototypes for four shapes- square, diamond, triangle, and circle.
  • Declare the variables for input number, character and shape choice.
  • Call the functions to display the output.
  • Define the function role in the respective function definition.

Summary Introduction- The program creates four shapes- square, diamond, triangle, and circle by accepting the two parameters first is the size and the second is the character.

Program Description- The purpose of the program is to create four shapes- square, diamond, triangle, and circle by accepting the two parameters first is the size and the second is the character. It uses the following four functions −

void Line( int, char );

void Square( int, char );

void Triangle( int, char );

void Diamond( int, char );

Blurred answer
Students have asked these similar questions
Key stroke enacted moving of a ball 1. Start (a) Write a Java program that uses the Up, ↑, Down ↓, Right → (and possibly Left) arrows of the keyboard (or keypad) to move a ball. (note the Up arrow is called “Up" with ASCII code 38, Down arrow is called "Down" with ASCII code 40, Right arrow is called "Right" with ASCII code. You can also use the 4 keys, commonly used in ODS game programming. Start Pond Figure 1. Initially Pond End End Start Pond Start Figure 2. After 3 moves up using up arrow End Pond End Figure 3. 3 moves later with right arrows Figure 4. Finally one at the lower right corner. (b) Using Java class JFrame to draw a grid of 5 horizontal lines, 5 vertical lines, a blue pond in the middle occupying 5 squares with a text Pond in the middle, a ball at the lower left corner, and texts called Start and End. This is shown exactly as in Figure 1 here. Change the color of ball from green to another color.
4. Area of a Rectangle • Write a program that compares the area of two rectangles. You can do this several ways. one way is to add the length and width of each rectangle to get it's area and then compare the two areas together. • The program should ask for the length and width of two rectangles and then tell the user which rectangle has the greater area, or if the areas are the same. • The area of a rectangle is the rectangle's length times its width. Name the source code file yourName HW4.py. • Test and run the program. Capture the output console and save it as an image file named yourName HW4 output.jpg. • Submit the py and the image files through Canvas. Note: Sample output below: Fast l: Code-Tracing Output in comenta Vart 21 Days of the Week
2. C program to draw pyramid with *. Ex – height 4: *** ***** ******* Hint: According to bottom line, find the number of blank characters at the first line(how many blank is at right side and how many blank is at left side?). If height of pyramid is 4, then bottom line has got 7 asterix ((4-1)*2+1). First line has got 6 blank (4-1 left side and 4-1 right side) characters and one Asterix (at the middle.

Chapter 5 Solutions

C How to Program (8th Edition)

Ch. 5 - Prob. 5.19ECh. 5 - (Displaying a Square of Any Character) Modify the...Ch. 5 - Prob. 5.21ECh. 5 - (Separating Digits) Write program segments that...Ch. 5 - (Time in Seconds) Write a function that takes the...Ch. 5 - (Temperature Conversions) Implement the following...Ch. 5 - (Find the Minimum) Write a function that returns...Ch. 5 - (Perfect Numbers) An integer number is said to be...Ch. 5 - Prob. 5.27ECh. 5 - (Reversing Digits) Write a function that takes an...Ch. 5 - (Greatest Common Divisor) The greatest common...Ch. 5 - (Quality Points for Students Grades) Write a...Ch. 5 - (Coin Tossing) Write a program that simulates coin...Ch. 5 - (Guess the Number) Write a C program that plays...Ch. 5 - (Guess the Number Modification) Modify the program...Ch. 5 - (Recursive Exponentiation) Write a recursive...Ch. 5 - (Fibonacci) The Fibonacci series 0, 1, 1, 2, 3, 5,...Ch. 5 - (Towers of Hanoi) Every budding computer scientist...Ch. 5 - Prob. 5.37ECh. 5 - Prob. 5.38ECh. 5 - Prob. 5.39ECh. 5 - Prob. 5.40ECh. 5 - (Distance Between Points) Write a function...Ch. 5 - Prob. 5.42ECh. 5 - Prob. 5.43ECh. 5 - After you determine what the program of Exercise...Ch. 5 - (Testing Math Library Functions) Write a program...Ch. 5 - Find the error in each of the following program...Ch. 5 - Prob. 5.47ECh. 5 - (Research Project: 1m proving the Recursive...Ch. 5 - (Global Warming Facts Quiz) The controversial...Ch. 5 - Prob. 5.50MDCh. 5 - Prob. 5.51MDCh. 5 - (Computer-Assisted Instruction: Monitoring Student...Ch. 5 - (Computer-Assisted Instruction: Difficulty Levels)...Ch. 5 - (Computer-Assisted Instruction: Varying the Types...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education