half dia pattern

I'm having problem to the lower part of the half diamond it is not really in place as is.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  #include <iostream>
  using namespace std;

    void halfDiamond(int Number)
    {
    for(int i = 1; i <= Number; i++){
    for(int j = 1; j <= i; j++){
    cout << " * ";
    }
    cout << "\n";
    }
    for(int i = 1; i < Number; i++){
    for(int j = i; j < Number; j++){
    cout << " * ";
    }
    cout << "\n";
        }
    }
    void otherHALFdiamond(int Number)
    {
    for(int row = 1; row <= Number; row++){
    cout << "\t";
    for(int space = Number - 1; space >= row; space--){
    cout << " ";
    }
    for(int star = 1; star <= row; star++){
    cout << " * ";
                }
    cout << "\n";
        }
    for(int row = 1; row < Number; row++){
    cout << "\t";
    for(int space = 1; space <= row; space++){
    cout << " ";
            }
    for(int star = row; star < Number; star++){
    cout << " * ";
                }
    cout << "\n";
        }
    }
 //--------------------------------------//
    int main(){
    int Number;
    char CONTINUE;
    do{
    {
    cout << "Enter size: ";
        cin >> Number;
    halfDiamond(Number);
    otherHALFdiamond(Number);
    cout << "Continue(y/n)? ";
    cin >> CONTINUE;
    }
        }while(CONTINUE == 'y');
    return 0;
}


desired output:

enter size: 5
* 
* * 
* * *
* * * * 
* * * * *
* * * * 
* * *
* 
                         *
                       * *
                     * * *
                   * * * *
                 * * * * *
                   * * * *
                     * * *
                       * *
                         *
Last edited on
Hello seghrein2300,

Are you saying that you did not understand the responses in http://www.cplusplus.com/forum/beginner/274442/ ?
Good day, Handy Andy.

Dang! I am sorry I forgot that I have made a topic about this and that I am not aware of. Anyway, thank you for reminding me.

I also forgot to reply to the topic that I've made about this before, I really forgot about it.

EDIT 1: Marking this solved, sorry everyone! My topic about this that I posted before is at http://www.cplusplus.com/forum/beginner/274442/.
Last edited on
Topic archived. No new replies allowed.