個人相片
海龍公式
翊涵(資研) 廖發表於2014年 10月 28日(二.) 13:49
#include <cstdlib>
#include <iostream>
#include <cmath>
using namespace std;

int main(int argc, char *argv[])
{
    cout << "請輸入三角形的三個邊長"<< endl;
    double a, b, ,c  ;
    float s ,area ;
    cin >> a;
    cin >> b;
    cin >> c;
    s=(a+b+c)/2 ;
    area=sqrt(s*(s-a)*(s-b)*(s-c)) ;
    if ((a+b)>c && (a+c)>b && (b+c)>a)
{
    cout << area << endl;
}
    else
{
    cout << "This is not a triangle." << endl;
}
    system ("pause") ;
    return EXIT_SUCCESS;
}
個人相片
回應: 海龍公式
Anny chen發表於2014年 10月 28日(二.) 14:10
 
double a, b, ,c ; //這一行,有兩個逗號喔