Question: c language Write a program called triangles that accepts command line arguments for a height ( h ), a character ( c ), orientation (
c language
Write a program called triangles that accepts command line arguments for a height (h), a character (c), orientation (o) and justification (j). The program will print a triangle of height h using the c character with orientation (Up or Down) and justification (Left, Right or Center). The usage should be something like triangles h c o j.
Some examples:
Command: triangles 7 '*' D R
Prints: Downward pointing, right-justified triangle of height 7 using the * character (note: you will need to put quotes around the * character when passing it as a command line argument because it has a special expansion in unix), as follows:
******* ****** ***** **** *** ** *
Command: triangles 4 ? U L
Prints: Upward pointing, left-justified triangle of height 4 using the ? character, as follows:
? ?? ??? ????
Command: triangles 3 X U C
Prints: Upward pointing, centered triangle of height 3 using the X character, as follows:
X XXX XXXXX
Note that each triangle is properly aligned (right, left, center) using the space character as necessary. Spacing is important for this assignment.
Write the code that does this. Error check appropriately.
Run at least two tests for each {orientation, justification} pair - one with an even number and one with an odd number. Make sure that everything works correctly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
