well thank
but i have learnt the lesson
also i have soleved this problem by for loop
but doing this by do while it gets infinite
i m unable to determine the problem
another problem that i encounter is that i m using turbo c++ on windows 7 i cant reopen the program not can save the ide
plz if u can guide me how to solve these problems
#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int i, j,k;
for (i=1; i<=2; i++)
{
for(j=1; j<=2; j++)
{
for (k=1; k<=4; k++)
{
cout<<"*";
}
{
cout<<"\n ";
}
}
}
getche();
}
the program it did using for loop
but problem is
stars appears in this pattern
****
****
****
****
while i m asked to do it like this
****
****
****
****
row 2 and 4 appears with keeping space from start
I do not understand why you are showing this code that has nothing common with your original post.
As for the additional space then it appears due to the statement
cout<<"\n ";
where the string literal consists from two characters: the new line character and the space.