Such as continuous one, can be written as If ys_jl (I - 1)=0 And ys_jl (I)=1 And ys_jl (I + 1)=0 first, Then on the third day of 0, the second day is 1, is the last day
If ys_jl (I - 1)=0 And ys_jl (I)=1 And ys_jl (I + 1)=1 And ys_jl (I + 2)=1 And ys_jl (I + 3)=1 And ys_jl (I + 4)=1 And ys_jl (I + 5)=0, Then this is 0, the first day on the sixth day of 0, 1, intermediate is the last 5 days of
So for 10 days or more, affirmation can't write, want to have a simple method of to 10 of the final three directly with loop or what... The above wrote together
CodePudding user response:
"Compiler principle" reference of lexical analysis and the finite state automata,//a string
//1 _22_333, 4444 __55555 _666666
//need to parse for
//1
//22
//333
//_
//4444
//55555
//666666
#include
Char [] s="_22_333, 1, 4444 __55555, _666666";
Char c, * p, * p;
Int st.
Void main () {
St=0;
P=s;
While (1) {
C=* p;
If (0==c) {
The switch (st) {
Case 1: printf (" _ \ n "); break;
Case 2: printf (" % s \ n ", (p1); break;
}
break;//
}
The switch (st) {
Case 0:
If (' _ '==c) {st=0; }
Else if (', ')==c {st=1; }
The else {p1=p; St=2; }
break;
Case 1:
If (' _ '==c) {st=1; }
Else if (', ')==c {printf (" _ \ n "); St=1; }
The else {p1=p; St=2; }
break;
Case 2:
If (' _ '==c) {* p=0; Printf (" % s \ n ", (p1); * p=c; St=0; }
Else if (', ')==c {* p=0; Printf (" % s \ n ", (p1); * p=c; St=1; }
The else {st=2; }
break;
}
P++;
}
}
//1
//22
//333
//_
//4444
//55555
//666666
CodePudding user response:
Don't know what is the principle!!!!!If ys_jl (I - 1)=0 And ys_jl (I)=1 And ys_jl (I + 1)=1 And ys_jl (I + 2)=1 And ys_jl (I + 3)=1 And ys_jl (I + 4)=1 And ys_jl (I + 5)=0 Then
What I want is on the statement ys_jl (I + j)=1, j=10 to 100 statement, how to write an if then, or in other ways
CodePudding user response:
Please adviceCodePudding user response:
Your problem description, it's really hard to understand the specific meaning,I wrote a piece of code, you consult:
Column A is A string of Numbers produced by using the random number function;
B column is different "digital" from which line, what is digital;
C column is "continuous digital repeated many times," where is the line end "repeat" (that is, it is "the next line," another number),
CodePudding user response:
Said once:B, C column is the code to run after the output, not "to fill in",