编写程序,从文本框1中输入的一个由字母和数字组成的字符串中,找出所有的数字,并依次连接,再输出到文 编写一个程序将用户输入的由字符和数字组成的字符串中的数字提取...
VB\u7f16\u7a0b\uff0c\u6025\u6c42\uff0c\u4ece\u6587\u672c\u68461\u4e2d\u8f93\u5165\u7684 \u4e00\u4e2a\u7531\u5b57\u6bcd\u548c\u6570\u5b57\u7ec4\u6210\u7684\u5b57\u7b26\u4e32\u4e2d\u627e\u51fa\u6240 \u6709\u7684\u6570\u5b57\u5e76\u4f9d\u6b21\u8fde\u63a5\uff0c\u518d\u8f93Private Sub Command1_Click()
T = ""
For i = 1 To Len(Text1)
If Mid(Text1, i, 1) Like "[0-9]" Then
T = T & Mid(Text1, i, 1)
End If
Next
Text2 = T
End Sub
#include int main()
{
char s[100];
int i, c, n;
gets(s);
for(i = c = n = 0; s[i]; i++)
{
if('0' <= s[i] && s[i] <= '9')
n = n * 10 + s[i] - '0';
else if(n)
{
printf("%d\n", n);
c++;
n = 0;
}
}
if(n)
{
printf("%d\n", n);
c++;
}
else if(c == 0)
printf("\u5b57\u7b26\u4e32\u4e2d\u6ca1\u6709\u6570\u5b57\n");
return 0;
}
按以下步骤完成:
定义两个字符串(A$,B$)
将文本框1的字符读入A$
按字节逐个读出A$的所有字符,
判断介于16进制30H-39H的数字字符保存到B$之中,其它字符舍弃
全部完成之后,将B$写入到第二个文本框之中
请问你需要用什么语言来实现呢?
绛旓細鎸変互涓嬫楠ゅ畬鎴愶細瀹氫箟涓や釜瀛楃涓诧紙A$,B$锛夊皢鏂囨湰妗1鐨勫瓧绗﹁鍏 鎸夊瓧鑺傞愪釜璇诲嚭A$鐨勬墍鏈夊瓧绗︼紝鍒ゆ柇浠嬩簬16杩涘埗30H-39H鐨勬暟瀛楀瓧绗︿繚瀛樺埌B$涔嬩腑锛屽叾瀹冨瓧绗﹁垗寮 鍏ㄩ儴瀹屾垚涔嬪悗锛屽皢B$鍐欏叆鍒扮浜屼釜鏂囨湰妗嗕箣涓
绛旓細1銆侀鍏堬紝鍦ㄧ獥浣撲笂闈㈡坊鍔犱竴涓枃鏈銆2銆佸崟鍑鏂囨湰妗嗭紝鍦ㄥ睘鎬х獥鍙h缃鏂囨湰妗嗙殑灞炴э紝娓呯┖鏂囨湰鍐呭锛屽皢鏂囨湰妗嗙殑enabled灞炴ц缃负False銆3銆佸弻鍑烩滄彁鍙栦俊鎭濆懡浠ゆ寜閽锛岀紪鍐欑▼搴忕殑浠g爜锛屽涓嬪浘鎵绀恒傛彁鍙栦俊鎭椂锛岄渶瑕佷娇鐢ㄦ埅鍙栧瓧绗︿覆鐩稿叧鐨勫嚱鏁帮紝濡侺eft,Right,Mid绛夈傛湰棰樿繕闇瑕佷娇鐢↖nStr鍑芥暟鏌ユ壘瀛楃銆4銆佸弻鍑...
绛旓細鎴戠敤鐨勬槸Text鏂囨湰妗 Private Sub Command1_Click()Dim a As Integer,b As Integer,c As Integera = Val(Text1.text)b = Val(Text2.text)c = a + Int(Abs(a - b)*Rnd())Text3.text = Str(c)End Sub
绛旓細Private Sub Command1_Click()Dim a As Integer, b As Integer, i As Integer, j As Integer Dim k As Integer, yes As Boolean a = CInt(Text1.Text)b = CInt(Text2.Text)For i = a To b yes = True For j = 2 To Sqr(i)If i Mod j = 0 Then yes = False Exit For En...
绛旓細Private Sub Command1_Click() For i = 1 To Len(Text1.Text) Select Case Asc(Mid(Text1.Text, i, 1)) Case 65 To 90, 97 To 122: a = a + 1 Case Is < 0: b = b + 1 End Select Next Text2.Text = a Text3.Text = bEnd Sub ...
绛旓細istr ="Visual Basic绋嬪簭璁捐鏁欑▼锛堢3鐗堬級"label1.caption=left(istr,12)label2.caption=mid(istr,13,6)label3.caption=right(istr,5)
绛旓細鍋囪鍛戒护鎸夐挳涓篶ommandbutton1 鍗曢夋寜閽畂ption1(0) 涓篠qr option1(1)涓篍xp 鍐浠ヤ笅绋嬪簭 Private Sub Command1_Click()If Option1(0).Value Then Text2.Text = Sqr(Val(Text1.Text))Else Text2.Text = Exp(Val(Text1.Text))End If End Sub ...
绛旓細涓嬮潰鏄畝鍗曞疄鐜帮紝闇瑕佸甫鍏ュ弬鏁版槸澶т簬绛変簬1鐨勬鏁帮紙鑷繁闃插憜)Private Sub Command1_Click() '璋冪敤瀹炰緥 Dim str As String MsgBox return_str(5)End SubPrivate Function return_str(number As Integer) As String '閫氱敤鍑芥暟 Dim str As String For i = 1 To number Dim str_temp As String ...
绛旓細private void button1_Click(object sender, EventArgs e){ string a, b, c = "";a = textBox1.Text.Trim();int x = 0, max = 0, min = 10;double avg = 0;for (int i = 0; i < a.Length; i++){ b = a.Substring(a.Length - i - 1, 1);c += b;x = Int32....
绛旓細// string str=Text1.text;int ji=0,ou=0,da=0,xiao=0,qita=0,temp;for(int i=0;i<str.length;i++){ if(str[i]>='a'&&str[i]<='z')//灏忓啓瀛楁瘝 { xiao++;} else if(str[i]>='A'&&str[i]<='Z')//澶у啓瀛楁瘝 { da++;} else if(str[i]>='0'&&str[i]<='9')...