I’m trying to create a table in C++ that asks you for the length of the sides and outputs a star table.
Can someone point me in the right direction as to what I should be doing to get the table to start displaying correctly?
input:
Enter length of side: 5
wanted output:
*****
* *
* *
* *
* *
*****
what I have so far outputs the first line of *’s minus one then displays the number you input.
#include "main.h"
using namespace std;
int main () {
int sideLength;
cout << "Enter lengh of side: ";
cin >> sideLength;
cout.fill('*');
cout.width(sideLength);
cout << sideLength << endl;
return 0;
}
thanks in advanced, just learning c++
you can do it like this: