Write a C++ program that inputs an integer and a single character from a keyboar
ID: 3647310 • Letter: W
Question
Write a C++ program that inputs an integer and a single character from a keyboard. The output should be the outline of a square composed of the character and extending the width specified by the integer. For example, if the integer is 5 and the character is *, your output should be as follows: The input number must be greater than or equal to 3. You must make sure the user enters a valid number. Use only nested for loops in this program - Don't use text messages to print pattern stars. Hint: Break the problem into three parts: Print the first line of characters using a single for loop using the integer value and character Print the middle lines of characters using two nested for loops, where it prints the character for first and last positions; and print blank spaces for other positions. For example, if integer value is 5 and character was '*', then at positions 1 and 5 it should print character '*' and blanks spaces at positions 2 to 4. You may need to use 'if' statements to set blank spaces for positions 2 to 4. Print the last line of characters using a single for loop using the integer value and character.Explanation / Answer
I ran this program and it works perfectly #include int main() { int row; int column; /* int x=4; char ch='*';*/ int err=1; while(err) { coutx; if(xRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.