相关讨论
输入三角形的三边长a,b,c,输出三角形的面积s。求面积的公式为:s=sqrt(1*(1-a)*(1-b)*(1-c)),其中1=(a+b+c)/2
方法一:
#include;
#include;
void main ( )
{
cout<< “input three data:\n”;
int a,b,c,s;
cin>;>;a>;>;b>;>;c;
if(a<=0||b<=0||c<=0)
{
cout<< “Negative argament!\n”;
exit (-1)
}
if (a+b<=c||b+c<=a||c+a<=b)
{
cout<< “Negative argament!\n”;
exit (-1);
}
s=(a+b+c)/...
要求如下:
1:输入一个字符
2:用这个字符打印出一个等边三角形出来.每个边20个点(用该字符)
我没头绪啊...大家帮忙..谢!!
public class YangHui{
public static void main(String args[]){
final int ROW=5;
int a[][]=new int[ROW+1][];
for(int i=0;i
}
运行结果:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/15092/showart_118683.html
by
ohai
-
C/C++
-
2003-08-22 19:19:14 阅读(2601) 回复(17)
命令序列:
grep main a.c b.c c.c>grepout &
wc -l等价,那位能说明一下
by
ffmm
-
网络技术
-
2005-11-09 20:06:28 阅读(859) 回复(2)