Home > Back-end >  New people for advice, for loop output
New people for advice, for loop output

Time:10-06

The couple, the for loop output
Request output
A
BBB
CCCCC
DDDDDDD

I hit a, but not perfect, don't know how to deal with



//AAABBB. CPP: defines the entry point of the console application,

# include "stdafx. H"
H # include "Windows."
# include "iostream"
using namespace std;

Int _tmain (int arg c, _TCHAR * argv [])
{
Int I, num, j, n;//variable declarations, num represent want to output graph the number of rows
Char z;//save the transformation of character
N=65;//A of ASCII
Cout<& lt;" Please input you want output graph the number of rows ";
cin> Num.//input data
//processing and result output
for(i=1; i{
For (j=1; j<=2 * I - 1; J++)
{
For (n=65; N<=j + 64; N++)
Z=n;
Cout}
Cout}

system("pause");
return 0;
}

CodePudding user response:

 
#include
using namespace std;

Int main ()
{
Int I, j, num.
Char n='A';
cout <"Please input to output graphics lines:" & lt; cin> Num.
for(i=1; i{
For (j=1; j<=2 * I - 1; J++)
{
cout }
n++;
cout }

return 0;
}

CodePudding user response:

The output is the triangle
 
#include
using namespace std;

Int main ()
{
Int I, j, num.
Char n='A';
cout <"Please input to output graphics lines:" & lt; cin> Num.
for(i=1; i{
for (j=0; j{
cout <"";
}
For (j=1; j<=2 * I - 1; J++)
{
cout }
n++;
cout }

return 0;
}

CodePudding user response:

refer to the second floor CHXCHXKKK response:
output is triangle
 
#include
using namespace std;

Int main ()
{
Int I, j, num.
Char n='A';
Cout & lt; <"Please input to output graphics lines:" & lt; cin> Num.
for(i=1; i{
for (j=0; j{
cout <"";
}
For (j=1; j<=2 * I - 1; J++)
{
cout }
N++;
cout }

return 0;
}


  • Related