Quick actions

cmd+k|ctrl+k

Navigation

Languages

2

Snippet info

Language

Cpp

Visibility

public

Author

fairlybet

Created

2019-09-23T16:42:09Z

Updated

2019-10-18T13:21:53Z


#include <iostream>

#include <cmath>

using namespace std;

void Task29()
{
	cout << "Task 29" << endl;
	cout << "sqrt(pow(x1, 2) + pow(x2, 2))" << endl;
	double x1 = 0, x2 = 0, z = 0;
	cout << "Input X1:" << endl;
	cin >> x1;
	cout << "Input X2:" << endl;;
	cin >> x2;
	z = sqrt(pow(x1, 2) + pow(x2, 2));
	cout << "Answer:" << z;
	cout << endl << endl;
}

void Task45()
{
	cout << "Task 45" << endl;
	cout << "abs(1 - abs(x))" << endl;
	double x = 0, z = 0;
	cout << "Input X:" << endl;
	cin >> x;
	z = abs(1 - abs(x));
	cout << "Answer:" << z;
	cout << endl << endl;
}

void Task15()
{
	cout << "Task 15" << endl;
	cout << "(2 * ctg(3 * x) - 1) / (12 * pow(x, 2) + 7 * x - 5)" << endl;
	double x = 0, z = 0;
	cout << "Input X:" << endl;
	cin >> x;
	if (12 * pow(x, 2) + 7 * x - 5 == 0 || x == 0)
	{
		cout << "No solutions at x=" << x;
	}
	else
	{
		z = (2 * (1 / tan(3 * x)) - 1) / (12 * pow(x, 2) + 7 * x - 5);
		cout << "Answer:" << z;
	}
	cout << endl << endl;
}

void Task31()
{
	cout << "Task 31" << endl;
	cout << "v0 * t - a * (pow(t, 2) / 2)" << endl;
	double v0 = 0, t = 0, a = 0, z = 0;
	cout << "Input v0:" << endl;
	cin >> v0;
	cout << "Input t:" << endl;
	cin >> t;
	cout << "Input a:" << endl;
	cin >> a;
	z = v0 * t - a * (pow(t, 2) / 2);
	cout << "Answer:" << z;
	cout << endl << endl;
}

void Task1()
{
	cout << "Task 1" << endl;
	cout << "(b + sqrt(pow(b, 2) + 4 * a * c)) / 2 * a - pow(a, 3) * c + pow(b, -2)" << endl;
	double a = 0, b = 0, c = 0, z = 0;
	cout << "Input a:" << endl;
	cin >> a;
	cout << "Input b:" << endl;
	cin >> b;
	cout << "Input c:" << endl;
	cin >> c;
	if (pow(b, 2) + 4 * a * c < 0 || 2 * a == 0)
	{
		cout << "No solutions";
	}
	else
	{
		z = (b + sqrt(pow(b, 2) + 4 * a * c)) / 2 * a - pow(a, 3) * c + pow(b, -2);
		cout << "Answer:" << z;
	}
	cout << endl << endl;
}

int main()
{
	system("cls");
	Task29();
	Task45();
	Task15();
	Task31();
	Task1();
}

INFO