1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ryzh [129]
3 years ago
13

Write a C++ programthat reads in the side of a square and prints out a pattern on$

Computers and Technology
1 answer:
AnnZ [28]3 years ago
7 0

Answer:

#include<iostream>

using namespace std;

//main function

int main(){

   //initialize the variables

   int side;

   //print the message

   cout<<"Please enter the side of square: ";

   cin>>side;  //read the vale and store in the variable.

   // for loop

   for(int i=1;i<=side;i++){  //lop for rows

       for(int j=1;j<=side;j++){   //loop for column

           cout<<"$";  //print the '*'

       }

       cout<<endl;

   }

}

Explanation:

Create the main function and declare the variable side.

print the message on the screen for the user and then store value enter by the user on the variable side.

take the nested for loop for print the pattern.

nested for loop means, loop inside another loop it is used for print the pattern having rows and columns.

the first loop updates the row number and the second the loop print the character '$' in the column-wise.

in the code,

if i = 1, for loop check the condition 1 <= 5 if the value of side is assume 5.

condition is true and the program moves to the second for loop and starts to print the character '$' five times after that, print the new line.

then, the above process repeat for different rows and finally, we get the pattern in square shape.

You might be interested in
You are given a data set with information from 1,000 high school students (of which the following is a part of the data) and ask
serg [7]

Answer:

Classification

Explanation:

Building a machine learning solution that can predict the success of a student in completing a college degree is a binary problem. There are two possible answer: success or not success.  

This brings us to a supervised machine learning problem, where one trains the technique with labeled data whether it is a success or not. Since the target variable is discrete (not continuous), classification technique has to be used.  

3 0
3 years ago
The document asks about dependents because the number can
BARSIC [14]
The answer is: Lower overall taxes
8 0
3 years ago
Read 2 more answers
Three periods after a menu item (...) mean that clicking that command will open
erastovalidia [21]

I think its B.) A dialog box


7 0
3 years ago
Read 2 more answers
Please help
MA_775_DIABLO [31]

Answer:

Key name

How to use it

Shift

Press Shift in combination with a letter to type an uppercase letter. Press Shift in combination with another key to type the symbol shown on the upper part of that key.

Caps Lock

Press Caps Lock once to type all letters as uppercase. Press Caps Lock again to turn this function off. Your keyboard might have a light indicating whether Caps Lock is on.

Tab

Press Tab to move the cursor several spaces forward. You can also press Tab to move to the next text box on a form.

Enter

Press Enter to move the cursor to the beginning of the next line. In a dialog box, press Enter to select the highlighted button.

Spacebar

Press the Spacebar to move the cursor one space forward.

Backspace

Press Backspace to delete the character before the cursor, or the selected text.

Typing (alphanumeric) keys. These keys include the same letter, number, punctuation, and symbol keys found on a traditional typewriter.

Control keys. These keys are used alone or in combination with other keys to perform certain actions. The most frequently used control keys are Ctrl, Alt, the Windows logo key  Picture of the Windows logo key, and Esc.

Function keys. The function keys are used to perform specific tasks. They are labeled as F1, F2, F3, and so on, up to F12. The functionality of these keys differs from program to program.

Navigation keys. These keys are used for moving around in documents or webpages and editing text. They include the arrow keys, Home, End, Page Up, Page Down, Delete, and Insert.

Numeric keypad. The numeric keypad is handy for entering numbers quickly. The keys are grouped together in a block like a conventional calculator or adding machine.

The following illustration shows how these keys are arranged on a typical keyboard. Your keyboard layout might be different.

Explanation:

3 0
2 years ago
(tco 7) the .net framework class library consists of ________ that provide many of the functions that you need for developing .n
Andre45 [30]
Code, which makes it work.
5 0
3 years ago
Other questions:
  • Make the correct match.
    11·1 answer
  • Search the internet for news of a motor vehicle collision in your community involving drugs or alcohol. Keeping in mind that you
    15·1 answer
  • In your presentation you added a text box to?
    5·1 answer
  • Which of the following statements is true of intrapreneurs
    15·1 answer
  • What port in your computer will you use to plug in your camera?
    14·2 answers
  • Can I change my username?
    6·1 answer
  • A home user reports to a network technician that the Internet is slow. The network administrator discovers that multiple unknown
    12·2 answers
  • Computers help eliminate that repetitive of manual task. How can this benefit you in in your overall career
    7·2 answers
  • Choose the parts of the browser window. PLEASE ANSWER QUICKLY TEST
    12·2 answers
  • 1. Insert a Header that has the following in excel​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!