Greetings.
Sorry, I didn't have time to really sit down and think.
Can't get 4 for loops, but I've got a while nested with 3 for loops.
Take it as a reference if you like.
I'll spend some more time to come out with one with 4-For loops. :cheesy:
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int num, odd, increment, space;
bool go;
num = 0;
increment = 1;
odd = 1;
go = false;
do{
cout<<"Enter number: ";
cin>>num;
}while(num<3);
if(num%2==0)
num = num + 1;
while(odd<=num)
{
space = num/2 - odd + increment;
if(go==false)
increment += 1;
else
increment -= 1;
for(int x=0; x<space; x++)
cout<<" ";
for(x=0; x<odd; x++)
cout<<"*";
for(x=0; x<space; x++)
cout<<" ";
cout<<endl;
if(go==false)
odd += 2;
else
odd -= 2;
if(odd>num && go==false)
{
odd = num - 2;
increment = num/2;
go = true;
}
if(odd<0)
odd = num + 1;
}
return 0;
}
Hope this helps.