hello friends
i start learning c++ and still at basics and was trying to solve a exercise in second chapter. this exercise asked to print a square using asterisks. i am able to create a asterisks solid square and colde is as follows.
# include<iostream>
using namespace std;
int main()
{
int row;
int col;
int size;
cout << "Please enter the size of square: ";
cin >> size;
for(col=1; col<=size; col++)
{
cout <<endl<<endl;
for(row=1; row <=size; row++)
{
cout << " * ";
}
}
system("pause");
return 0;
}
problem is that i dont need solid square only sides and program should be able to create any size of squrare specified by user. Desired output should look like this
* * * * *
* *
* *
* *
* * * * *
Please can any one give me hint what should i do, i dont need code at the moment i wanna have a go at it first. thanx in advance for any tips.