excuse me, could you check my problem? please

Write a program that uses cycles for to generate the following bosses separately, one under other one. Use Cycles for to generate the bosses. All the asterisks (*) must be stamped(printed) by means of an alone instruction of the form cout '*'; (this does that the asterisks print one next to other one). [Suggestion: the last two bosses need that every Line begins with an appropriate number of blanks. Additional credit: combine your code of four problems separated in an alone program that it prints four patterns, one next to other one, doing an intelligent use of the cycles For sheltered.] something like this.

* ********** ********** *
** ********* ********* **
*** ******** ******** ***
**** ******* ******* ****
***** ****** ****** *****
****** ***** ***** ******
******* **** **** *******
******** *** *** ********
********* ** ** *********
********** * * **********

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

/*how can i optimize this code?
what is wrong into the code?
what can it be improved?

Write a program that reads a nonnegative integer and
computes and prints its factorial*/
//triangle exercise
//25/09/18
//ilus

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main(int argc, char** argv)
{
	
	int number;
	int figureCharaterThreeLimit;
	int figureSpaceThreeLimit;
	int figurelimit;
	int figureTwoLimit;
	int spaceOneLimit;
	int spaceDosLimit;
	int spaceThreeLimit;
	int CharacterSpaceOneLimit;
	int CharacterSpaceTwoLimit;
	int CharacterSpaceThreeLimit;
	
	cout << "Ingresa un numero limite: ";
	cin >> number;

	//variables figuras
	figureTwoLimit = number;
	figureCharaterThreeLimit = number; 
	figureSpaceThreeLimit = 0; 
	figurelimit = number;
	
	//contadores de espacio
	spaceOneLimit = 0;
	spaceDosLimit = number;	
	spaceThreeLimit = 0; 
	
	CharacterSpaceOneLimit = number;
	CharacterSpaceTwoLimit = 0;
	CharacterSpaceThreeLimit = 0;
	
	for(int counter = 0; counter < 1; counter++)
	{
		
		for(int column = 1; column <= number; column++)
		{
			//figura uno
			for(int row = 0; row < column; row++)
			{
				cout << "* ";
			}
			
			//espacio
			for(int space = 1; space <= spaceOneLimit; space++)
			{
				cout << "";
			}
			spaceOneLimit++;
			
			for(int row = 1; row <= CharacterSpaceOneLimit; row++)
			{
				cout << "  ";
			}
			CharacterSpaceOneLimit--;
			
			//figura dos
			for(int row = 1; row <= figureTwoLimit ; row++)
			{
				cout << " *";
			}
			figureTwoLimit--;
			
			//espacio 2
			for(int space = 1; space <= spaceDosLimit; space++)
			{
				cout << "";
			}
			spaceDosLimit--;
			
			for(int row = 0; row <= CharacterSpaceTwoLimit; row++)
			{
				cout << "  ";
			}
			CharacterSpaceTwoLimit++;
			
			//figura 3
			for(int space = 1; space <= figureSpaceThreeLimit; space++)
			{
				cout << "  ";
			}
			figureSpaceThreeLimit++;

			for(int row = 1; row <= figureCharaterThreeLimit; row++)
			{
				cout << "* ";
			}
			figureCharaterThreeLimit--;

			//espacio 
			for(int row = 1; row <= figurelimit ; row++)
			{
				cout << "  ";
			}
			figurelimit--;
			
			//figura 4
			for(int space = 1; space <= spaceThreeLimit; space++)
			{
				cout << "  ";
			}
			spaceThreeLimit--;
			
			for(int row = 0; row <= CharacterSpaceThreeLimit; row++)
			{
				cout << "* ";
			}
			CharacterSpaceThreeLimit++;
			
			cout << endl;			
		}
	}	
	return 0;
}
Last edited on
can someone check it out? please.
your problem statement is very garbled: it looks like the output of translate program. I have no idea what it is you want to do. I cannot say if it works because of this.
sorry sir, the topic is updated, check it out again please.
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
#include <iostream>
using namespace std;


void draw( int rows, int cols, char black, bool (*white)( int, int ) )
{
   for ( int i = 0; i < rows; i++ )
   {
      for ( int j = 0; j < cols; j++ ) cout << ( white( i, j ) ? ' ' : black );
      cout << '\n';
   }
   cout << '\n';
}


int main()
{
   const int N = 10;
   const char C = '*';

   cout << "Under each other ...\n\n";
   draw( N, N, C, []( int i, int j ){ return j > i         ; } );
   draw( N, N, C, []( int i, int j ){ return j < i         ; } );
   draw( N, N, C, []( int i, int j ){ return j + i >= N    ; } );
   draw( N, N, C, []( int i, int j ){ return j + i <  N - 1; } );

   cout << "\n\nNext to each other ...\n\n";
   draw( N, 2 * N + 5, C, []( int i, int j ){ return j == i + 1 || j == N + 2 || i + j == 2 * N + 3; } );
}


Under each other ...

*         
**        
***       
****      
*****     
******    
*******   
********  
********* 
**********

**********
 *********
  ********
   *******
    ******
     *****
      ****
       ***
        **
         *

**********
********* 
********  
*******   
******    
*****     
****      
***       
**        
*         

         *
        **
       ***
      ****
     *****
    ******
   *******
  ********
 *********
**********



Next to each other ...

* ********** ********** *
** ********* ********* **
*** ******** ******** ***
**** ******* ******* ****
***** ****** ****** *****
****** ***** ***** ******
******* **** **** *******
******** *** *** ********
********* ** ** *********
********** * * **********
Last edited on
Topic archived. No new replies allowed.