An exercise in Chapter 5 of Tan Haoqiang s C Language Design 3rd Edition will help me solve it

Updated on home 2024-04-06
4 answers
  1. Anonymous users2024-02-07

    According to my understanding, after understanding that a cone is formed by a right triangle rotated 360 degrees, it only involves some junior high school knowledge (two-point distance formula, parallel line properties), and the final v is what is sought.

    #include

    #include

    #include

    double len( double x1, double y1, double x2, double y2 );

    void main()

    double x = ;

    double y = ;

    int st = 0;

    double h = ;

    double c = ;

    double r = ;

    double v = 0;

    scanf("%lf %lf", &x, &y );

    if( (c = len( 2, 2, x, y ) r ) st = 1;

    else if( (c = len( 2,-2, x, y ) r ) st = 1;

    else if( (c = len( -2, -2, x, y ) r ) st = 1;

    else if( (c = len( -2, 2, x, y ) r ) st = 1;

    else v = 0;

    if( st != 0 )

    v = ( r-c )*h / r;

    printf("v = %lf",v);

    double len( double x1, double y1, double x2, double y2 )

    return sqrt( (x1-x2)*(x1-x2) +y1-y2)*(y1-y2) )

  2. Anonymous users2024-02-06

    What he means is that if you enter a coordinate, if this coordinate is within any of the four circles, the point is on the tower, and the tower height is 10, so the output should be 10, and any other point, the output is 0, understand?

  3. Anonymous users2024-02-05

    "C++Primer" After reading it once, you will know how much gap there is between domestic C++ education and foreign ones. If you can read C++Primer thoroughly, Effective C++ and More Effective C++ will be your better choice. These three books are step-by-step, and when you understand them all, you will be considered proficient in C++.

  4. Anonymous users2024-02-04

    Learn programming with ease with action**. This topic uses Tan Haoqiang's classic C++ textbook: C++ Programming (2nd Edition).

Related questions
16 answers2024-04-06

Definition of a for loop.

for(the initial value of the variable; termination of operating conditions; The initial value of the first cycle i is 0, and it runs until i=3 stops i=2, and the condition is still satisfied, and the loop body is still executed, and the step size is 1+1 each time >>>More

9 answers2024-04-06

Hey! This is a very simple function to write, Your Excellency is estimated to have just learned data structures, now learn sorting, lookup, it's easy to give me a reward of two hundred points, I'll help you write it right away. >>>More

7 answers2024-04-06

It's called the [batch] program, in fact, don't think that the program you mentioned above to deal with garbage is really powerful, it's amazing, when you have learned DOS, that program can be said to be a very simple thing; >>>More

8 answers2024-04-06

system("command");The role is to open the "Command Prompt", and later you can manually enter DOS commands. >>>More

5 answers2024-04-06

Question 1: pt1=&a;pt2=&b;pt1 and pt2 are not defined, years are defined as. >>>More