Answer:
Following are the program to this question:
#include <iostream>//defining header file
using namespace std;
void squareOfAsterisks(int x) //defining method squareOfAsterisks
{
int i,j; //defining integer variable
for(i=1;i<=x;i++) //defining loop to print column value
{
for(j=1;j<=x;j++) //defining loop to print row value
{
cout<<"*"; //print value
}
cout<<endl; //for line break
}
}
int main() //defining main method
{
int x; //defining integer variable
cout<<"Enter any number: "; //print message
cin>>x; //input value from user
squareOfAsterisks(x); //calling the method and pass the value
return 0;
}
Output:
Enter any number: 4
****
****
****
****
Explanation:
The description of the above program can be given as follows:
- In the given program a method "squareOfAsterisks" is declared, that accepts an integer value "x" in its arguments, inside the method two integer variable I, j is used, that uses a to print the given pattern.
- In the main method, an integer variable x is declared, which takes input from the user end, and then calls the method, that is "squareOfAsterisks" and passes its value.
Select the
comments feature.
We use comments in our documents to track issues for follow
up or make suggestions to other people. A comment is inserted inside a balloon or
a box that appears in the document's margins. Whatever the situation you may be in,
you can easily add comments in a word document.
Generally we'd need "the following" if the question asks about it. Senioritis usually affects high school seniors IIRC.
Answer:
Option D is the correct choice answer for the above question.
Explanation:
"exit()" is a function that is used to transfer the control of the program to the end of the program and the program gets terminated. This function defines in many programming languages. The syntax of this function is as follows--
exit() // syntax of the exit function.
Hence anybody can say that "exit" function is used to terminate the program if there are many lines belongs after the "exit()" function. Hence option D is the correct answer while other is not because--
- Option A states about the "terminate()" function which is not the function of any programming language.
- Option B states about the "return()" function which is also not the function of any programming language but "return" is a statement used to return the value.
- Option C states about the "continue()" function which is used in a loop to escape the other line of the loop and continue it.