回覆列表
  • 1 # 藍風24

    沒指明用什麼語言, 用C寫了。

    #include

    #include

    int main(){

    double x1, y1, x2, y2, x3, y3;

    double k, b, t;

    //輸入3個座標:

    printf("Input point A:x, y:");

    scanf("%lf, %lf", &x1, &y1);

    printf("Input point b:x, y:");

    scanf("%lf, %lf", &x2, &y2);

    printf("Input point C:x, y:");

    scanf("%lf, %lf", &x3, &y3);

    k = (y2-y1)/(x2-x1);

    b = y1-k*x1;

    t = k*x3 + b;

    if (fabs(y3-t)

    printf("三點在一條直線上。\n");

    else

    printf("三點不在一條直線上。\n");

    return 0;

    }

  • 中秋節和大豐收的關聯?
  • 21省考!會迎來往屆生的春天嗎?