Can anybody help me with this.. we are to make a diamond pattern of asterisk..I had the codes below..My problem is.. we are only allowed to use one asterisk and one space to make the program and inside the diamond pattern we are to put the letters A,B, and C..
Can anyone pls...
#include <iostream.h>
#include <math.h>
#include<conio.h>
void main (void)
{
int r,c,s;
int space,asterisk;
asterisk=1;
space = 7/2+1;
for(r=1;r<=7;r++)
{
//for the spacing
for(s=0;s<space;s++)
{
cout << " ";
}
for(c=asterisk;c>0;c--)
{
if(r==4)
{
if(c==3)
{
cout << "L";
}else if(c==4)
{
cout << "V";
}else if(c==5)
{
cout << "A";
}else
{
cout << "*";
}
}else{
cout << "*";
}
}
//to check each line and compute how many asterisk and spaces to display
if(r>=4){
asterisk = asterisk - 2;
space ++;
}else{
asterisk= asterisk + 2;
space --;
}
//to proceed to the next line
cout << "\n";
}
}