已知三角形的底和高,求出三角形的面积。 每行输入底和高 //这句话要怎么实现它每行输出三角形的面积。精确到三位小数。 Sample Input
1 2
3 4
5 6Sample Output
1.000
6.000
15.000
1 2
3 4
5 6Sample Output
1.000
6.000
15.000
解决方案 »
- 急!!!请求帮助!!! aptana插件在eclipse中没有提示,怎么办?
- JAVA设计模式
- 怎么将application转换成applet?
- Object class 在Java和.Net中的比较,多线程部分
- 为什么我的聊天窗口不能通信呢?
- 肯请,哪位仁兄,给1个简单的使用 oscache 的例子
- 关于RandomAccessFile对象的问题!!马上给分!
- 乱码!!!!!在线等待
- ******* 100分 提供一个jbuilder for umix(red hat linux or solaris )的下载地址
- java进程莫名的假死,调用jmap/jstack后恢复工作
- 求助new A().func(new A.());这个程序哪里错了?要怎么改啊?
- 这个程序的匿名类应该怎样改才是正确的!
你是问System.in.read()的用法?
{
int countOfStudent=5,i=0;
float score[]=new float[countOfStudent];
try {
BufferedReader in = new BufferedReader(new FileReader("company.record")); while ((str=in.readLine()) != null&&i++<countOfStudent) {
score[i] = Float.parseFloat(in.readLine().trim());
}
in.close();
} catch (IOException e) {
//IOException happened!
System.out.println("Exception was thrown when reading from file!");
}
//求平均值,排序我就不写了~
.....
}
BufferedReader in = new BufferedReader(new FileReader("Input.txt")); if((str1=in.readLine()) != null&&(str2=in.readLine()) != null) {
a=Float.parseFloat(str1.trim());
h=Float.parseFloat(str2.trim());
}
s=a*h/2;
in.close();
} catch (IOException e) {
//IOException happened!
System.out.println("Exception was thrown when reading from file!");
}