Advertisement
savrasov

Untitled

Apr 10th, 2017
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. // sandbox.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <algorithm>
  6. #include <iostream>
  7. #include <string.h>
  8. #include <cstring>
  9. #include <math.h>
  10. #include <cmath>
  11. #include <vector>
  12. #include <utility>
  13. #include <cstdlib>
  14. #include <deque>
  15. #include <queue>
  16. #include <iomanip>
  17. #include <stack>
  18. #include <map>
  19. #include <cmath>
  20. #include <fstream>
  21. #include <list>
  22.  
  23. #define LD ld
  24. #define LL ll
  25. #define ULL ull
  26. #define pow(a, b) pow((ld)a, (ld)b)
  27. #define pb push_back
  28. #define pf push_front
  29. #define pof pop_front
  30. #define pob pop_back
  31. #define fir first
  32. #define sec second
  33. #define mp make_pair
  34. #define for1(it1, a, b) for(int it1 = a; it1 < b; it1++)
  35. #define for2(it2, a, b) for(int it2 = a; it2 < b; it2++)
  36. #define for3(it3, a, b) for(int it3 = a; it3 < b; it3++)
  37. #define for4(it4, a, b) for(int it4 = a; it4 < b; it4++)
  38.  
  39. typedef long long ll;
  40. typedef unsigned long long ull;
  41. typedef long double ld;
  42. typedef unsigned int uint;
  43.  
  44. const int nn = 3 * (int)1e5 + 10;
  45. const ld eps = 3 * 10e-9;
  46. const ull INF = (ull)(1e19 * 1.7);
  47. const ull mod = 1000000007;
  48.  
  49. using namespace std;
  50.  
  51. void shablon(double a, double b, double c, double d, double e, double f, double g, double h, int i)
  52. {
  53. if(!i) cout << fixed << setprecision(0) << noshowpos << "Vertex of a parabola: " << a << "x^2" << showpos << b << "x" << c << endl << endl;
  54. else if(i == 1) cout << fixed << setprecision(0) << noshowpos << "To solve the equation: " << a << "x^2" << showpos << b << "x" << c << " = 0" << endl << endl;
  55. else if (i == 2) cout << fixed << setprecision(0) << noshowpos << "Express a variable: " << a << "x = " << b << showpos << c << e << "x"<< f << endl << endl;
  56. else if (i == 3) cout << fixed << setprecision(2) << noshowpos << "Count: " << a << showpos << b << c << d << e << f << g << h << endl << endl;
  57. }
  58.  
  59. double gen()
  60. {
  61. double r = 0;
  62. for (int i = 0; i < 100; i++)
  63. if (rand() % 2) r += (double)rand();
  64. else r += (double)rand() * 1.1253451031 + (double)rand() - (double)rand() * 5.4615678646;
  65. while(abs(r) > 40)
  66. if (r < 0) r += rand();
  67. else r -= rand();
  68. return r;
  69. }
  70.  
  71. int main()
  72. {
  73. freopen("out.txt", "w", stdout);
  74. int n;
  75. srand(time(0));
  76. cin >> n;
  77. for (int i = 0; i < n; i++)
  78. {
  79. double a[20];
  80. for (int k = 0; k < 8; k++) a[k] = gen();
  81. shablon(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], (rand() + rand()) % 4);
  82. }
  83. return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement