Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <stdio.h>
- #include <windows.h>
- #include <locale.h>
- #include <iostream>
- int _tmain(int argc, _TCHAR* argv[])
- {
- int a, b, c = 0;
- int D = 0;
- float x1, x2 = 0;
- printf("enter a\n");
- std::cin >> a;
- printf("enter b\n");
- std::cin >> b;
- printf("enter c\n");
- std::cin >> c;
- D = (b*b) + (-4 * a*c);
- if (D > 0)
- {
- printf("2 koren\n");
- x1 = (-b + sqrt(D)) / (2 * a);
- x2 = (-b - sqrt(D)) / (2 * a);
- std::cout << "1 koren: " << x1 << "\n2 koren: " << x2;
- }
- if (D == 0)
- {
- printf("1 koren");
- x1 = -(b / (2 * a));
- std::cout << "1 koren: " << x1;
- }
- if (D < 0)
- {
- printf("no koren");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment