Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are required to write a C + + program that draws a specific geometric shape in the console, based on the digits of your
You are required to write a program that draws a specific geometric shape in the console, based on the digits of your
student ID number.
Task Description
Your main task is to create a C application that:
Read your student ID from the keyboard.
Determine the type and dimensions of the shape to draw based on the digits in your ID
Output the shape directly to the console.
Shape Rules
Based on the last digit of your student ID your program should draw one of the following shapes:
If the last digit is either or : Rectangle
If the last digit is either or : Right triangle
If the last digit is either or : Isosceles triangle
If the last digit is either or : Inverted right triangle
If the last digit is either or : Diamond
The dimensions of the shapes should be determined by specific digits in your ID:
Rectangle: The height is the summation of the first digits of your ID and width is the summation of the last digits
of your ID respectively.
Triangles and Diamond: The height of the triangle or diamond is determined by the summation of the first digits of
your ID For triangles, the height is equal to the number of lines, while the height of the diamond is twice this number
minus one.
Example Output
For a student ID of the last digit is and the summation of the first digits is
is the hight of the diamond
the output will be a diamond:
Submission Requirements
Submit the source code files and screenshot for your output based on your student ID
Ensure your program compiles and runs without errors.
the ID is
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started