Advertisement
J00ker

Untitled

Oct 9th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. void Prob1() {
  8.     float a, b, c, delta, x1, x2, aux;
  9.     //scanf("%d", a);
  10.     //scanf("%d", b);
  11.     //scanf("%d", c);
  12.     scanf("%f %f %f", &a, &b, &c);
  13.     //printf("%d %d %d", a, b, c);
  14.  
  15.     aux = 1.0; delta = 0.0;
  16.     aux *= b;
  17.     aux *= b;
  18.     delta += aux;
  19.  
  20.     aux -= aux;
  21.     aux += 4;
  22.     aux *= a;
  23.     aux *= c;
  24.     delta -= aux;
  25.  
  26.     aux = sqrt(delta);
  27.     x1 = x2 = aux;
  28.     x1 -= b;
  29.     x2 += b;
  30.  
  31.     x1 /= 2;
  32.     x1 /= a;
  33.     x2 /= 2;
  34.     x2 /= a;
  35.  
  36.     printf("x1 = %f \nx2 = %f", x1, x2);
  37.  
  38. }
  39.  
  40. void Prob2() {
  41.     int a, b, c, mx;
  42.     scanf("%d %d %d", &a, &b, &c);
  43.  
  44.     mx = (a > b) ? (a) : (b);
  45.     mx = (mx > c) ? (mx) : (c);
  46.  
  47.     printf("%d", mx);
  48. }
  49.  
  50. void Prob3() {
  51.     int a, b;
  52.     scanf("%d %d", &a, &b);
  53.  
  54.     printf("%d : %d = %d rest %d", a, b, (a / b), (a % b));
  55. }
  56.  
  57. void Prob4() {
  58.     float xa, ya, xb, yb;
  59.     scanf("%f %f %f %f", &xa, &ya, &xb, &yb);
  60.  
  61.     float aux1 = (xa - xb) * (xa - xb);
  62.     float aux2 = (ya - yb) * (ya - yb);
  63.     float aux3 = sqrt(aux1 + aux2);
  64.     printf("%f\n", aux3);
  65.     cout << aux3;
  66. }
  67.  
  68. void ProbS() {
  69.     int i, n = 3;
  70.     for(i = 0; i < n; --i)
  71.         cout << '$';
  72.     /// $$$
  73. }
  74.  
  75. int main()
  76. {
  77.     Prob1();
  78.     //Prob2();
  79.     //Prob3();
  80.     //Prob4();
  81.  
  82.     //printf("%.2d", sqrt(16.0));
  83.     //ProbS();
  84.     return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement