Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // sandbox.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <algorithm>
- #include <iostream>
- #include <string.h>
- #include <cstring>
- #include <math.h>
- #include <cmath>
- #include <vector>
- #include <utility>
- #include <cstdlib>
- #include <deque>
- #include <queue>
- #include <iomanip>
- #include <stack>
- #include <map>
- #include <cmath>
- #include <fstream>
- #include <list>
- #define LD ld
- #define LL ll
- #define ULL ull
- #define pow(a, b) pow((ld)a, (ld)b)
- #define pb push_back
- #define pf push_front
- #define pof pop_front
- #define pob pop_back
- #define fir first
- #define sec second
- #define mp make_pair
- #define for1(it1, a, b) for(int it1 = a; it1 < b; it1++)
- #define for2(it2, a, b) for(int it2 = a; it2 < b; it2++)
- #define for3(it3, a, b) for(int it3 = a; it3 < b; it3++)
- #define for4(it4, a, b) for(int it4 = a; it4 < b; it4++)
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- typedef unsigned int uint;
- const int nn = 3 * (int)1e5 + 10;
- const ld eps = 3 * 10e-9;
- const ull INF = (ull)(1e19 * 1.7);
- const ull mod = 1000000007;
- using namespace std;
- void shablon(double a, double b, double c, double d, double e, double f, double g, double h, int i)
- {
- if(!i) cout << fixed << setprecision(0) << noshowpos << "Vertex of a parabola: " << a << "x^2" << showpos << b << "x" << c << endl << endl;
- else if(i == 1) cout << fixed << setprecision(0) << noshowpos << "To solve the equation: " << a << "x^2" << showpos << b << "x" << c << " = 0" << endl << endl;
- else if (i == 2) cout << fixed << setprecision(0) << noshowpos << "Express a variable: " << a << "x = " << b << showpos << c << e << "x"<< f << endl << endl;
- else if (i == 3) cout << fixed << setprecision(2) << noshowpos << "Count: " << a << showpos << b << c << d << e << f << g << h << endl << endl;
- }
- double gen()
- {
- double r = 0;
- for (int i = 0; i < 100; i++)
- if (rand() % 2) r += (double)rand();
- else r += (double)rand() * 1.1253451031 + (double)rand() - (double)rand() * 5.4615678646;
- while(abs(r) > 40)
- if (r < 0) r += rand();
- else r -= rand();
- return r;
- }
- int main()
- {
- freopen("out.txt", "w", stdout);
- int n;
- srand(time(0));
- cin >> n;
- for (int i = 0; i < n; i++)
- {
- double a[20];
- for (int k = 0; k < 8; k++) a[k] = gen();
- shablon(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], (rand() + rand()) % 4);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement