* shaped diamond program

I am making a program which prints diamond shaped asterick signs.... Having 1 error on using namespace std;
Can any 1 tell where I am wrong????

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream.h>
#include <stdlib.h>
using namespace std;
int main()
{
int i=0, j=0, NUM=3;
for(i=-NUM; i<=NUM; i++)
{
for (j=-NUM; j<=NUM; j++)
{
if ( abs(i)+abs(j) <=NUM) //change this condition
{ cout<<"*"; }
else { cout<<" ";}
}
cout<<endl;
}
return 0;
}
Either remove this directive or use the following headers

#include <iostream>
#include <cstdlib>

instead of

#include <iostream.h>
#include <stdlib.h>
Removed the directive and all set... Thanks alot.
Topic archived. No new replies allowed.