Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void printLeft (int n){
- int star = n;
- int space = n-1 ;
- for(int i = 1; i<= n-1 ;i++){
- for (int j= 1 ; j<= space ; j++){
- cout<<" ";
- }
- for ( int j =1; j<= star ;j++){
- cout<<"*";
- }
- cout<<endl;
- star --;
- space --;
- }
- cout<<"*"<<endl;
- star = 2;
- space = 1;
- for(int i = 1; i<= n-1 ;i++){
- for (int j= 1 ; j<= space ; j++){
- cout<<" ";
- }
- for ( int j =1; j<= star ;j++){
- cout<<"*";
- }
- cout<<endl;
- star ++;
- space ++;
- }
- }
- void printRight ( int n ){
- int star = n ;
- int space =0 ;
- for (int i=1 ;i<= n-1;i++){
- for (int j =1 ;j<= space ;j++){
- cout<<" ";
- }
- for (int j= 1; j<= star ; j++){
- cout<<"*";
- }
- cout<<endl;
- star--;
- space +=2 ;
- }
- for (int i = 1; i<= (n-1)* 2; i++){
- cout<<" ";
- }
- cout<<"*"<<endl;
- star = 2 ;
- space =( n- 2) * 2;
- for(int i =1 ;i<= n-1; i++ ){
- for (int j= 1; j<= space ;j++){
- cout<<" ";
- }
- for (int j=1 ;j<=star ;j++ ){
- cout<<"*";
- }
- cout<<endl;
- star ++;
- space -=2 ;
- }
- }
- void printArrow(int n, bool left){
- if ( left == true ){
- printLeft ( n);
- }
- else printRight(n);
- }
Advertisement
Add Comment
Please, Sign In to add comment