0分求调!!!

P5735 【深基7.例1】距离函数

abababwosb @ 2024-09-04 09:03:27

#include <bits/stdc++.h>
using namespace std;

double dis(double a1, double b1, double a2, double b2) {
    int tmp;
    tmp = sqrt(pow((a1 - a2), 2) + pow((b1 - b2), 2));
    return tmp;
}

int main() {
    double a1, a2, a3, b1, b2, b3, tmp = 0;
    cin >> a1 >> b1 >> a2 >> b2 >> a3 >> b3;
    tmp += dis(a1, b1, a2, b2);
    tmp += dis(a1, b1, a3, b3);
    tmp += dis(a2, b2, a3, b3);
    printf("%.2f", tmp);
    return 0;
}

by Hollow_Knight @ 2024-09-04 09:13:00

有没有一种可能,你dis函数返回值是int类型的变量


by Hollow_Knight @ 2024-09-04 09:13:10

@abababwosb


by abababwosb @ 2024-09-04 09:34:43

说得对 @Hollow_Knight


|