//计算结果格式:
//A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,
//AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,
//BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BL
private void buttonXP1_Click(object sender, System.EventArgs e)
{
string s="A";
for(int i=0;i<2700;i++)
{
this.richTextBox1.Text +=s+",";
s=InreasingData(s);
}
MessageBox.Show(s) ;
}
private string InreasingData(string strTemp)
{
int i=strTemp.Length ;
char[] ca=new char[i];
ca=strTemp.ToCharArray();
bool bCarryFlag=true;
int w=i-1;
int AddResult=(int)ca[w];
AddResult+=1;
while((bCarryFlag)&&(w>=0))
{
if(AddResult>90)
{
ca[w]='A';
if(w>0)
AddResult=(char)((int)ca[w-1]+1);
bCarryFlag=true;
}
else
{
ca[w]=(char)((int)ca[w] +1);
bCarryFlag=false;
}
w--;
}
strTemp="";
for(int j=0;j<i;j++)
{
strTemp+=ca[j].ToString();
}
if((w<0)&&(bCarryFlag))
{
strTemp="A"+strTemp;
}
return strTemp;
}
//A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,
//AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,
//BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BL
private void buttonXP1_Click(object sender, System.EventArgs e)
{
string s="A";
for(int i=0;i<2700;i++)
{
this.richTextBox1.Text +=s+",";
s=InreasingData(s);
}
MessageBox.Show(s) ;
}
private string InreasingData(string strTemp)
{
int i=strTemp.Length ;
char[] ca=new char[i];
ca=strTemp.ToCharArray();
bool bCarryFlag=true;
int w=i-1;
int AddResult=(int)ca[w];
AddResult+=1;
while((bCarryFlag)&&(w>=0))
{
if(AddResult>90)
{
ca[w]='A';
if(w>0)
AddResult=(char)((int)ca[w-1]+1);
bCarryFlag=true;
}
else
{
ca[w]=(char)((int)ca[w] +1);
bCarryFlag=false;
}
w--;
}
strTemp="";
for(int j=0;j<i;j++)
{
strTemp+=ca[j].ToString();
}
if((w<0)&&(bCarryFlag))
{
strTemp="A"+strTemp;
}
return strTemp;
}
Private Sub ButtonXP1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonXP1.Click
Dim i As Int16 = 0
Dim s As String = "A"
Me.RichTextBox1.Text &= s & "',"
For i = 0 To 1000
s = IncreasingData(s)
Me.RichTextBox1.Text &= s & "',"
Next
End Sub
Private Function IncreasingData(ByVal strTemp As String) As String
Dim i As Integer = strTemp.Length
Dim ca(i) As Char
ca = strTemp.ToCharArray()
Dim bCarryFlag As Boolean = True
Dim w As Integer = (i - 1)
Dim AddResult As Integer = Microsoft.VisualBasic.AscW(ca(w))
AddResult += 1
While ((bCarryFlag) And (w >= 0))
If (AddResult > 90) Then
ca(w) = "A"
If (w > 0) Then
AddResult = Microsoft.VisualBasic.AscW(ca(w - 1)) + 1
bCarryFlag = True
End If
Else
ca(w) = Microsoft.VisualBasic.ChrW(Microsoft.VisualBasic.AscW(ca(w)) + 1)
bCarryFlag = False
End If
w = w - 1
End While
strTemp = ""
Dim j As Integer = 0
For j = 0 To i - 1
strTemp &= ca(j).ToString()
Next
If ((w < 0) And (bCarryFlag)) Then
strTemp = "A" & strTemp
End If
Return strTemp
End Function
Dim i As Int16 = 0
Dim s As String = "A"
Me.RichTextBox1.Text &= s & "',"
For i = 0 To 1000
s = IncreasingData(s)
Me.RichTextBox1.Text &= s & "',"
Next
End Sub
Private Function IncreasingData(ByVal strTemp As String) As String
Dim i As Integer = strTemp.Length
Dim ca(i) As Char
ca = strTemp.ToCharArray()
Dim bCarryFlag As Boolean = True
Dim w As Integer = (i - 1)
Dim AddResult As Integer = Microsoft.VisualBasic.AscW(ca(w))
AddResult += 1
While ((bCarryFlag) And (w >= 0))
If (AddResult > 90) Then
ca(w) = "A"
If (w > 0) Then
AddResult = Microsoft.VisualBasic.AscW(ca(w - 1)) + 1
bCarryFlag = True
End If
Else
ca(w) = Microsoft.VisualBasic.ChrW(Microsoft.VisualBasic.AscW(ca(w)) + 1)
bCarryFlag = False
End If
w = w - 1
End While
strTemp = ""
Dim j As Integer = 0
For j = 0 To i - 1
strTemp &= ca(j).ToString()
Next
If ((w < 0) And (bCarryFlag)) Then
strTemp = "A" & strTemp
End If
Return strTemp
End Function