Hey guys,
I have a rough code here that displays a Square asterisk, Oval shaped asterisk, Arrow asterisk and a Diamond asterisk, and it displays vertically, but I cant figure out how to display my output horizontally.
here's my code so far,
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int i=0, j=0, NUM=3,r=0, s=0, iNUM=3, x, h, k, b;
for(int col=0; col<4; col++)
{
cout <<endl<<endl;
for(int row=0; row<4; row++)
{
if((col==0 || col==4-1) || (row==0) || (row ==4-1))
{
cout << " * ";
}
else cout<<" ";
}
}
/*Oblong*/
cout<<"\n\n";
for(x=1;x<=6;x++)
{
if(x==1 || x==6)
{
for(h=1;h<=7;h++)
{
if(h==3 || h==4 || h==5)
cout<<"*";
else
cout<<" ";
}
cout<<endl;
}
else
if(x==2||x==5)
{
for(k=1;k<=7;k++)
{
if(k==2||k==6)
cout<<"*";
else
cout<<" ";
}
cout<<endl;
}
else
{
for(b=1;b<=7;b++)
{
if(b==1||b==7)
cout<<"*";
else
cout<<" ";
}
cout<<endl;
}
}
/*arrow*/
int count = 0;
cout<<"\n";
for (int width = 0; width <= 3; width++)
{
for (int alignLeft = width; alignLeft <= 2; alignLeft++)
{
cout << " ";
}
for (int space = 1; space < count; space++)
{
cout << "*";
}
cout << endl;
count += 2;
}
cout<<" * \n";
cout<<" * \n";
cout<<" * \n";
cout<<" * \n";
/*diamond*/
cout<<"\n";
for(r=-iNUM; r<=iNUM; r++)
{
for(s=-iNUM; s<=iNUM; s++)
{
if( abs(r)+abs(s)==iNUM)
{
cout<<"*"; }
else { cout<<" ";}
}
cout<<endl;
}
getch();
return 0;
}
I would be glad if you guys can help out.
still a rookie here. :))
-Dan