Friday, July 31, 2009

C++ problems: can anyone help me to solve programs related to nested looping?

actually i am studying basic fundamentals of c++ language and finding it bit difficult with solving or doing programs and that of too nested looping example like how to create a diagram i mean like how to show diamond like structure after u run your program(after compiling) so anyone out there can help to sort out these problems. surely any help would surelysolve my problem.

C++ problems: can anyone help me to solve programs related to nested looping?
Here it goes





#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;





void main()


{int i,j;


clrscr();


for(i=5;i%26gt;0;i--)


{ for(j=0;j%26lt;11;j++)


{if(i-j==0) printf("/");


else


{if(11-i==j) printf("\\");


else printf(" ");


}


}


printf("\n");


}


for(i=1;i%26lt;6;i++)


{for(j=0;j%26lt;11;j++)


{if(i-j==0) printf("\\");


else


{if(11-i==j) printf("/");


else printf(" ");


}


}


printf("\n");


}





getch();


}





Hope this helps you and you will see this for answer!!!
Reply:if u are using two loops suppose then the 1st one is for number of rows and the 2nd for no. of columns try it.
Reply:Go here


http://www.cpp-home.com/forum/index.php


You will get way better answers from them.

brenda song

No comments:

Post a Comment