Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program class named SquareDisplay that asks the user for a positive inte

ID: 3760226 • Letter: W

Question

Write a program class named SquareDisplay that asks the user for a positive integer no greater than 15. The program should then display a square on the screen using the character ‘X’. The number entered by the user will be the length of each side of the square. For example, if the user enters 5, the program should display the following:

XXXXX

XXXXX

XXXXX

XXXXX

XXXXX

INPUT and PROMPTS. The program prompts for an integer as follows: "Enter an integer in the range of 1-15: ". OUTPUT . The output should be a square of X characters as described above. CLASS NAMES. Your program class should be called SquareDisplay

Explanation / Answer

#include<iostream>
#include<limits.h>
using namespace std;


int main(){
  
   int number = 20;
   while(number > 15)
       cin>>number;
   for(int i = 0; i < number; i++){
       for(int j = 0 ; j < number; j++){
           cout<<"X ";
       }
       cout<<endl;
   }
  
  
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote