Di Posting Oleh : Simple Learning
Kategori : box shape box shape program c++ c++ box shape
Program Specifications:
- Program uses for loops only to print box shape
- Symbol used is asterisk (*)
- Program prints fixed size box
- To change the size change the values of for loops
C++ Code:
- #include<iostream>
- using namespace std;
- int main()
- {
- for(int a=1;a<=10;a++)
- {
- cout<<"*";
- }
- cout<<endl;
- for(int b=1;b<=5;b++)
- {
- for(int c=1;c<=1;c++)
- {
- cout<<"*";
- }
- for(int d=1;d<=8;d++)
- {
- cout<<" ";
- }
- cout<<"*"<<endl;
- }
- for(int e=1;e<=10;e++)
- {
- cout<<"*";
- }
- return 0;
- }
Image View Of Code:(click image for large view)
box shape using for loop c++ Programming Sample Output:(Click on Image To View in Big Size)
More Programs:
C++ Shapes Programs
C++ Simple Programs
As in programming there are always more than one
ways to code try more than one ways to learn fast.
0 Response to "C++ Program to print box shape using for loop "
Post a Comment