Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

please help!

Status
Not open for further replies.

vinzent

Programmer
Aug 14, 2000
1
0
0
MY
if I write a programme like<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br>&nbsp;&nbsp;&nbsp;&nbsp;***<br>&nbsp;&nbsp;&nbsp;*****<br>&nbsp;*********<br>***********<br>&nbsp;*********<br>&nbsp;&nbsp;&nbsp;*****<br>&nbsp;&nbsp;&nbsp;&nbsp;***<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br><br>but I don't want to use &quot;printf structure&quot;<br>by the way if I use for loop structure how do I arrange the asterik.<br>can I use array to do this question?how?<br>please help me.<br>thank u.
 
You can allways use the function putc();&nbsp;&nbsp;Or you can use fprintf() and send the characters to the stdout buffer.&nbsp;&nbsp;or you can use puts() which dumps out a string to a buffer.&nbsp;&nbsp;Oh, the screen in dos, C sees as the stdout buffer, which is what i mean by a buffer.&nbsp;&nbsp;<br>ex using printf<br>printf(&quot;&nbsp;&nbsp;*&nbsp;&nbsp;\n&quot;);<br>printf(&quot; *** \n&quot;);<br>??????????<br>was this what your were looking for ?????<br><br><br><br> <p>ackka<br><a href=mailto:tmoses@iname.com>tmoses@iname.com</a><br><a href= my site</a><br>"Do No Harm, Leave No Tracks, Be Respectful"<br>
ICMP Summer 2000, 2600 Article<br>
<br>
 
I hope the following Program may help U.
#include<stdio.h>
int main(void)
{
i,j,k,a[9]={1,3,5,7,9,7,5,3,1};

for(i=0;i<9;i++)//loop for stars
{
putchar('\n');
if(i<=4)
{
for(j=0;j<10-a+i;j++)//loop for spaces for first 5 lines
putchar(' ');
}
else
for(k=0;k<i+1;k++)//loop for spaces for last 4 lines
putchar(' ');
for(k=0;k<a;k++)//loop for printing stars
putchar('*');
}
}

Please tell Ur view about this as early as possible.
 
friend in earlier program
in the last for loop some mistake is there due
to typing mistake.
the last for loop in the program is
for(k=0;k<a;k++)
putchar('*');
but it should be
for(k=0;k<a;k++)
putchar('*');

sorry for the type of inconvience.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top