diagonal lines...

hi, im new in c++ and im trying to make a z line, the outpout should be like this
********
      *
     *
    *
   *
  *
 *
********


here's my code
1
2
3
4
5
6
7
8
9
10
11
12
int main()                           
{                                          
    int x;                                     
    char y;                                    
                                               
                                               
    for(int i=1;i<=10;i++)                     
    cout <<'*';                                
    for(int i=10;i>=0;i--)                     
    cout <<setw(10)<<'*'<<"\n";       
    for(int i=1;i<=10;i++)
    cout <<'*';

now i don't know how to make a diagonal line, in order to create z.any suggestion?tnx

edit:
this my ouput of the program i figure out how this forum works:
********             
*
*
*
*
*********

Last edited on
The figure you posted seems to be more like a C than a Z
This forum sometimes cuts off consecutive spaces, I don't know why. I assume he wants a Z.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
int main() 
{ 
   int x; 
   char y; 

   for(int i=1;i<=10;i++) 
   {
      cout <<'*'; 
   }
   cout << "\n";
   for(int i=10;i>=2;i--) 
   {
      cout <<setw(i)<<'*'<<"\n";
   }
   for(int i=1;i<=10;i++)
   {
      cout <<'*';
   }
}

x, y are unnecessary it seems?

Topic archived. No new replies allowed.