Fan 2:
In this post of shapes in c you will be able to construct the code for a fan (Part 2) 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";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++)cout<<" ";for(int spaces=i ; spaces<=size ; spaces++){if(i==0)cout<<"* ";elseif(spaces==i || spaces==size)cout<<"* ";elsecout<<" ";}for(int j=i ; j<size ; j++)cout<<" ";for(int j=0; j<=i ; j++){if(i==size)cout<<"* ";elseif(j==0 || j==i)cout<<"* ";elsecout<<" ";}cout<<endl;}for(int m=0 ; m<=size ; m++){for(int spaces1=m ; spaces1<=size ; spaces1++){if (m==0)cout<<"* ";elseif(spaces1==m || spaces1==size)cout<<"* ";elsecout<<" ";}for(int n=0; n<m ; n++)cout<<" ";for(int spaces1=0 ; spaces1<=m ; spaces1++){if(m==0 || m==size)cout<<"* ";elseif(spaces1==0 || spaces1==m)cout<<"* ";elsecout<<" ";}cout<<endl;}return 0;}
Is cool :P
ReplyDeleteThanks :)
Deleteif u give input as @#,or expect any buutons then output goes worng/somewhere
ReplyDeleteexcept number
DeleteDon't enter input other than numeric values because the size you are entering is a numerical value therefore its data type is int so, that's why you're entering a char value which is not accepted by int!!!
Delete