Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Figuring. Im completely lost in the concept. 2:477 LTE vega.cs.kent.edu 2. Figures. Create a projoct titled Lab3 Figures with a single fille tigures.epp. Your program
Figuring. Im completely lost in the concept.
2:477 LTE vega.cs.kent.edu 2. Figures. Create a projoct titled Lab3 Figures with a single fille tigures.epp. Your program should ask the user for a number and then print two squares, two diagonal limes and a cross out of stars as shown below. The figure size should be input by the user. Here is an example dialog: Input numberi 4 Note that your program has to work for an arbitrary inicger, mot just 4. You can use either while or tor looping constructs Hints: For each figure, you need to use two nested loops: the outer loop will iterate over rows (of stars) and the inner loop will print out the stars in a single row. The programming structure for all figures is similar. Study the code for the dmte oga This progranm has nested loops which are very similar to what you need to implement I suggest you code and debug the first figure printout and them proceed to the next. The figure order is in the increasing difficulty. For the second figure, the star is printed in the column that is equal to the row. That is, the loop variable of the outer loop should be present in the loop-expression of the inener loop. Consider the sumbers of now and columns in a table. These numbers will be reflected by the loop variablex: In the second figure (the first diagonal linek you print a star when the row index is equal o the colume index In the third figure, you print a star when the column index is the same as the maximum number of rows minus the column index The code for the cross is the combination of the code for the two diagonal lines. To code the hollow square, coesider using a multiway if with the following logic If it is the first line then print a star else if it is the last line then print a star else if itis the first column then print a star 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