This is my assignment for compsci and im stuck at the very end of how to get the field of stars '*' to repeat how ever many times the user wants.
Write a program that prints out a series of fields of stars (i.e., “*”). Each field will have n rows and m columns. Enable the user to enter the number of rows (at least 1 but no more than 5) and columns (at least 5 but no more than 50), as well as the number of fields (at least 3, but no more than 10). Each field must be separated by 3 complete blank lines.
Your program must include at least two functions: one to get the input data from the user, and one to draw each field. Use for loops to construct the fields, as well as to print out the multiple fields. Do NOT use a string of “”. Rather, print out individual “”.
code
#include <iostream>
using namespace std;
void displayField(int numrows, int numcolums);
void getData (int numrows, int numcolumns, int numfields);
const char c = '*';
int main(void)
{
int numrows, numcolumns, numfields;
cout << "Welcome to the banner creation program!" << endl;
cout << "Enter the number of rows (1 - 5) --> ";
cin >> numrows;
if(numrows<1 || numrows>5){
cout << "Your entered value is outside the range!" << endl;
cout << "Program will now halt..." << endl;
exit(0);}
cout << "Enter the number of columns (5 - 50) --> ";
cin >> numcolumns;
if(numcolumns<5 || numcolumns>50){
cout << "Your entered value is outside the range!" << endl;
cout << "Program will now halt..." << endl;
exit(0);
}
cout << "Enter the number of rows (3 - 10) --> ";
cin >> numfields;
if(numfields<3 || numrows>10){
cout << "Your entered value is outside the range!" << endl;
cout << "Program will now halt..." << endl;
exit(0);
}
for(int i=1; i<=numrows; i++){
for (int j=1; j<=numcolumns; j++)
cout << c;
cout <<endl;
}
}