Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n, a, b, midpoint;
- std::cin>>n;
- midpoint = (n + 1)/2;
- for(a = 0; a <= midpoint; a++) {
- for(b = 0; b <= (midpoint*2); b++) {
- if( (b == (midpoint - a)) || (b == (midpoint + a)) ) {
- std::cout<<" * ";
- }//end of star printing condition
- else {
- std::cout<<" ";
- }//end of space condition
- }//end of col constructor
- std::cout<<std::endl;
- }//end of row constructor
- for(a = midpoint-1; a >= 0; a--) {
- for(b = 0; b <= (midpoint*2); b++) {
- if( (b == (midpoint - a)) || (b == (midpoint + a)) ) {
- std::cout<<" * ";
- }//end of star printing condition
- else {
- std::cout<<" ";
- }//end of space condition
- }//end of col constructor
- std::cout<<std::endl;
- }//end of row constructor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement