Fan 1:
In this post of shapes in c you will be able to construct the code for a fan (Part1) in C++ using "*".
Code:
/* Join us athttp://shapesinc.blogspot.comfor more codes of shapes*/#include<iostream>using namespace std;int main(){cout << "Join http://shapesinc.blogspot.com for more codes of shapes\n\n";
cout<<"CAUTION: The input should not be other than numerical values \n\n\a";int size;cout << "Enter the size of fan" << endl;cin>>size;for(int i=0 ; i<=size ; i++){for(int j=0 ; j<=i ; j++){if(i!=size){if(j==0 || j==i)cout<< "* ";elsecout<<" ";}else if (i==size )cout<< "* ";}for(int spaces=i ; spaces<size ; spaces++)cout<<" ";for(int j=i ; j<=size ; j++){if(i==0)cout<< "* ";elseif(j==i || j==size)cout<<"* ";elsecout<<" ";}cout<<endl;}for(int m=0 ; m<=size ; m++){for(int spaces1=m ; spaces1<size ; spaces1++)cout<<" ";for(int n=0; n<=m ; n++){if(m==size)cout<<"* ";elseif(n==0 || n==m)cout<<"* ";elsecout<<" ";}for(int spaces1=0 ; spaces1<m ; spaces1++)cout<<" ";for(int n=m; n<=size; n++){if(m==0)cout<<"* ";elseif(n==m || n==size)cout<<"* ";elsecout<<" ";}cout<<endl;}return 0;}
0 comments:
Post a Comment