Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Why does c++ program define double output integer?
Why does c++ program define double output integer?
//yours? Constructor:

int? C (point? A, point? b)? //what is returned is int? //change it to double.

{Double? sum,s 1,S2;

s 1 = ABS(a . x-b . x);

S2 = ABS(a . y-b . y);

sum = 2.0 *(s 1+S2);

Return? Sum;

}

int? C (double? R){// What is returned is int? //change it to double.

Return? (2.0 * pi * r);

}

//Check the output again

c 1=C(a,b);

C2 = C(r);

cout & lt& ltc 1 & lt; & ltendl & lt& ltc2 & lt& ltendl////output the return values of c (a, b) and c (r).

//How can it not be cosmetic surgery? To get a double, change the return types of the above two functions.