C++ Shapes Code
Draw hollow diamond shape in c++ code in which user enter its desire size of diamond
Using nested for loop and asterisk
like below image: click here to get code
Draw inverted triangle on output console using nested for loop and asterisk '*' character
Like Below Image click here or image to find code
inverted triangle c++ code |
write a c++ program which draw a hollow triangle on output console using nested for loop and asterisk character
Like Below image Click here to get code
draw a hollow triangle |
write a C++ code which draw an isosceles triangle using nested for loop
Like Below Image click here to get code
which draw an isosceles triangle using nested for loop |
write a program to draw Upside down filled isosceles triangle code using for loop C++ code
Like Below Image click here to get code
upside down filled isosceles triangle code C+ |
C++ code to print right triangle pattern using for loop
Click on image to view code:
C++ Code Box Shape :
Click on image to view full code
Hollow Box shape using for loop and if else statement
sample output : click on image to view full code
C++ SHAPES:
CODE SHAPES
USING NESTED FOR “*”.
*
**
***
****
*****
CODE
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1; i<=5; i++)
{
for(int j=1; j<=i; j++)
{
cout<<"*";
}
cout<<endl<<endl;
}
getch();
}
C++ SHAPES:
CODE SHAPE USING NESTED FOR “*”.
*****
****
***
**
*
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=5; i>=1; i--)
{
for(int j=1; j<=i; j++)
{
cout<<"*" ;
}
cout<<endl<<endl;
}
getch();
}
C++ SHAPES:
CODE SHAPES USING NESTED FOR “*”.
*
**
***
****
*****
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1; i<=5; i++)
{
for(int k=5; k>i; k--)
{
cout<<" ";
}
for(int j=1; j<=i; j++)
{
cout<<"*";
}
cout<<endl<<endl;
}
getch();
}
C++ SHAPES:
CODE SHAPES USING NESTED FOR “*”.
*****
****
***
**
*
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=5; i>=1; i--)
{
for(int k=5; k>i; k--)
{
cout<<" ";
}
for(int j=1; j<=i; j++)
{
cout<<"*";
}
cout<<endl;
}
getch();
}
CODE SHAPES USING NESTED FOR “*”.
1*****
12****
123***
1234**
12345*
123456
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1; i<=6; i++)
{
for(int k=1,a=1; k<=i; k++)
{
cout<<a; a++;
}
for(int j=5; j>=i; j--)
{
cout<<"*";
}
cout<<endl<<endl;
}
getch();
}
Click on image to view full code
Hollow Box shape using for loop and if else statement
sample output : click on image to view full code
C++ SHAPES:
CODE SHAPES
USING NESTED FOR “*”.
*
**
***
****
*****
CODE
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1; i<=5; i++)
{
for(int j=1; j<=i; j++)
{
cout<<"*";
}
cout<<endl<<endl;
}
getch();
}
C++ SHAPES:
CODE SHAPE USING NESTED FOR “*”.
*****
****
***
**
*
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=5; i>=1; i--)
{
for(int j=1; j<=i; j++)
{
cout<<"*" ;
}
cout<<endl<<endl;
}
getch();
}
C++ SHAPES:
CODE SHAPES USING NESTED FOR “*”.
*
**
***
****
*****
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1; i<=5; i++)
{
for(int k=5; k>i; k--)
{
cout<<" ";
}
for(int j=1; j<=i; j++)
{
cout<<"*";
}
cout<<endl<<endl;
}
getch();
}
C++ SHAPES:
CODE SHAPES USING NESTED FOR “*”.
*****
****
***
**
*
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=5; i>=1; i--)
{
for(int k=5; k>i; k--)
{
cout<<" ";
}
for(int j=1; j<=i; j++)
{
cout<<"*";
}
cout<<endl;
}
getch();
}
CODE SHAPES USING NESTED FOR “*”.
1*****
12****
123***
1234**
12345*
123456
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1; i<=6; i++)
{
for(int k=1,a=1; k<=i; k++)
{
cout<<a; a++;
}
for(int j=5; j>=i; j--)
{
cout<<"*";
}
cout<<endl<<endl;
}
getch();
}
No comments:
Post a Comment