题目内容

阅读以下说明和Visual Basic代码,填入(n)处。
[说明]
在一些财务软件中,经常需要将阿拉伯数字的账目转化为汉语习惯中的金额计数方法,例如:
“3.45”转化为“叁元四角五分”;
“3.4”转化为“叁元四角”;
“3.40”转化为“叁元四角零分”;
“3.456”转化为“叁元四角五分”;
“345.00”转化为“叁百四十五元零角零分”;
“345”转化为“叁百四十五元”;
以下Visual Basic代码实现了小写金额转换为大写金额。界面如图10-9所示。结合实际例子说明,仔细阅读下面代码,将(n)代码补充完整。
[代码7-1]
Begin VB.FormForm1
Caption = "小写金额转换为大写金额"
//...窗体描述(略)
Begin VB.CommandButton Command1
Caption = "退出"
//...窗体描述(略)
End
Begin VB.TextBox Text2
//...窗体描述(略)
End
Begin VB.TextBox Text1
Enabled = 0 'False
//…窗体描述(略)
End
Begin VB.Labe1 Labe12
Caption = "转换为大写金额"
//...窗体描述(略)
End
Begin VB.Labe1 Labe11
Caphon = "请输入数字"
//...窗体描述(略)
End
End
[代码7-2]
Private Function setdata (num As Integer) As String '数字转换
Select CaSe num
Case 0
setdata="零"
Case 1
Setdata="壹"
Case 2
Setdata="贰"
Case 3
Setdata="叁"
Case4
Setdata="肆"
Case 5
Setdata="伍"
Case 6
Setdata="陆"
Case 7
Setdata="柒"
Case 8
Setdata="捌"
Case 9
Setdata="玖"
End Select
End Function
Private Function chang (aaa As Integer) As String '位数转换
Select CaSe aaa
Case 1
chang=""
Case 2
chang="十"
Case 3
chang="百"
Case 4
chang="千"
Case 5
chang="万"
Case 6
chang="十"
Case 7
chang="百"
Case 8
chang="千"
Case 9
chang="亿"
Case 10
chang="十"
End Select
End Function
[代码7-3]
Private Sub Text2_Change () '小写转大写
Dim i As Integer
Dim j As Integer
Dim myint As Integer
Dim myint1 As Integer
Dim mydoub As Double
Dim mystr As String
Dim mystr1 As String
Dim mystr2 As String
Dim mystr3 As String
Dim mystr4 As String
Dim money As Long
Dim money1 As Integer
Dim money2 As Long
mystr=Text2.Text
myint=InStr (mystr, ".")
If myint=0 Then
mystr=Text2.Text
Else
mystr3=Right(Text2.Text, Len (Text2.Text ) - myint)
If mystr3<>""Then '转换小数位
mystr4=Left(mystr3, 1)
mystr3=Right(mystr3, Len(mystr3 )

查看答案
更多问题

土地市场是有形的土地和()、()、()等的统一体。

请补充函数fun(),该函数的功能是:把字符下标为非素数的字符从字符串sb中删除,把字符下标为素数的字符重新保存在字符串e口中。字符串sb从键盘输入,其长度作为参数传入函数fun()。
例如,输入“abcdefghijkl”,输出“cdfhl”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
include <stdio.h>
define N 80
void fun(char s[],int n)
{
int i, j, k, flag;
【 】;
for(i=0; i<n; i++)
{
if (i>1)
s [k++] =s [i];
flag=I;
for(【 】; j<i&&flag; j++)
if (i%j==0)
{
flag=0;
【 】
}
}
s [k]='\0';
}
main()
{
int i=0, strlen=0;
char str[N];
clrscr ();
printf("\n Input a string:\n");
gets (str);
while (str [i] !='\0')
{
strlen++;
i++;
}
fun (str, strlen);
printf("\n*** display string ***\n");
puts (str);
}

阅读以下说明和JAVA 2代码,填入(n)处。
[说明]
以下JAVA程序设计了类CSet,使用同一个名称(set)的method来传入数据。仔细阅读[代码6-1)、[代码6-2]和[代码6-3]和相关注释,将程序补充完整。
[代码6-1]
import java.io.*;
class CSet
{
private int width;
private int height;
(1)
public void set(String color)
{
col=color; //(a)可输入长方形的颜色
}
public void set (iht w, int h)
{
width=w; //(b)可输入长方形的宽和高
height=h;
}
public void set (String color, int w, int h)
{
col=color; //(c)可输入长方形的颜色、宽和高
width=w;
height=h;
}
public void show ()
{
System.out.println ("n\长方形的颜色为: "+col);
System.out.println ("n\长方形宽为: "+width+" 长方形高为: "+height");
}
}
[代码6-2]
public class hw8_3
{
public static void main (String args[]) throws IOException
{
intw, h; //声明宽、长变量,并给予赋值
String color, k;
CSet rect1;
rect1=new CSet ();
System.out.print ("\n请输入颜色:: ");
color=input ();
System.out.print ("请输入宽度:: ");
k=input ();
w=Integer.parseInt (k);
System.out.print ("请输入高度:: ");
k=input();
h=Integer.parseInt (k);
(2)//设置长方形的颜色
(3)//设置长方形的宽、高
rectl.show ();
(4)//设置长方形的颜色和宽、高
rectl.show ();
}
[代码6-3]
public static String input() throws IOException//输入函数
{
String str;
BufferedReader buf;
(5)
str=buf.readLine ()
return str;
}
}

Ireland became so dependent on it that hundreds of thousands of Irish people starved when

答案查题题库