Home > Back-end >  String a newline
String a newline

Time:11-19

#include
#include

# define HEIGHT 7//according to the following definition, each letter HEIGHT is 7 lines

Const char * letters []={
"\
\ # # # # # # # # @ \
\ # # @ \
\ # # @ \
# # # # # # @ \
\ # # @ \
\ # # @ \
\ # # @ \
"
"\
# # # # @ \
\ # # @ \
\ # # @ \
\ # # @ \
\ # # @ \
\ # # @ \
# # # # @ \
"
"\
# # # # # # @ \
# # # # @ \
\ # # @ \
# # # # # # @ \
\ # # @ \
# # # # @ \
# # # # # # @ \
"
"\
# # # # @ \
# # # # @ \
# # # # @ \
\ # # # # # # # # # @ \
# # # # @ \
# # # # @ \
# # # # @ \
"
"\
# # # # # # @ \
# # # # @ \
\ # # @ \
\ # # @ \
\ # # @ \
# # # # @ \
# # # # # # @ \
"
};

Int main ()
{
Int I, j;
Int gap;

Printf (" please enter the letters of the interval number (space) : ");
The scanf (" % d ", & amp; Gap);

//line printed
for (i=0; i {
//print all the letters of a row
For (j=0; J & lt; 5; J++)
{
//k used to iterate over each line of '#' character
Int k=0;
//calculate the letters each line how many characters
[j] int len=strlen (letters)/HEIGHT;
//calculate the current print which line
Int line=I * len;

//@ it signaled the end of the
While (letters [j] [line + k]! )
='@'{
Putchar (letters [j] [the line] + k);
k++;
}

//print letters between interval (space)
Int temp=gap;
While (temp)
{
Putchar (");
}
}
Putchar (" \ n ");
}

return 0;
}

This string of code inside the initialization code backslash \ and @ is what mean

CodePudding user response:

Line at the end of the line continuation, \ said \ # is complains,

CodePudding user response:

Comments made it very clear
//@ marks the end of the bank

CodePudding user response:

People don't like this style of programming, too not directly,

CodePudding user response:

 # include & lt; Stdio. H> 
#include

# define HEIGHT 7//according to the following definition, each letter HEIGHT is 7 lines

Const char * letters []={
"# # # # # # # # @ \
# # @ \
# # @ \
# # # # # # @ \
# # @ \
# # @ \
# # @ ",
"# # # # @ \
# # @ \
# # @ \
# # @ \
# # @ \
# # @ \
# # # # @ ",
"# # # # # # @ \
# # # # @ \
# # @ \
# # # # # # @ \
# # @ \
# # # # @ \
# # # # # # @ ",
"# # # # @ \
# # # # @ \
# # # # @ \
# # # # # # # # # @ \
# # # # @ \
# # # # @ \
# # # # @ ",
"# # # # # # @ \
# # # # @ \
# # @ \
# # @ \
# # @ \
# # # # @ \
# # # # # # @ \
"
};

Int main ()
{
Int I, j, gap;

Printf (" please enter the letters of the interval number (space) : ");
The scanf (" % d ", & amp; Gap);

//line printed
For (I=0; i //print all the letters of a row
For (j=0; J & lt; 5; J++) {
//k used to iterate over each line of '#' character
Int k=0;
//calculate the letters each line how many characters
[j] int len=strlen (letters)/HEIGHT;
//calculate the current print which line
Int line=I * len;

//@ it signaled the end of the
While (letters [j] [line + k]!='@') {
Putchar (letters [j] [the line] + k);
k++;
}

//print letters between interval (space)
Int temp=gap;
While (temp) {
Putchar (");
}
}
Putchar (" \ n ");
}

return 0;
}

This program can run, modify the define the character "" in front of

CodePudding user response:

\ newline at the end of the line, @ wrote in annotations means a newline, but \ # is complains!!!!!!

CodePudding user response:

"\ n" is a line break
  • Related