Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int age;
- char wybor;
- do {
- system("cls");
- /*cout << "What is your age? \n";
- cin >> age;
- if (age > 5) {
- cout << "Your age is more than 5. \n";
- }
- else if (age == 0) {
- cout << "You are 5 years old. \n";
- }
- else {
- cout << "Your age is less than 5. \n";
- }
- cout << "Your age is: " << age << endl; */
- /*
- int a, b;
- cout << "Put your first number \n";
- cin >> a;
- cout << "Put your second number \n";
- cin >> b;
- */
- /*cout << "Sum of your numbers is: " << a + b <<endl; */
- /*while (a > b) {
- cout << a << " is bigger than " << b << endl;
- break;
- }
- while (b > a) {
- cout << b << " is bigger than " << a << endl;
- break;
- }
- while (a==b) {
- cout << a << " and " << b << " are even numbers \n";
- }
- */
- /*
- if (a > b) {
- cout << a << " is bigger than " << b << endl;
- }
- else if (a < b) {
- cout << b << " is bigger than " << a << endl;
- }
- else {
- cout << a << " and " << b << " are even numbers \n";
- }
- */
- double a, b, c, delta;
- cout << "Put a: ";
- cin >> a;
- cout << "Put b: ";
- cin >> b;
- cout << "Put c: ";
- cin >> c;
- delta = b * b - (4 * a * c);
- if (delta > 0) {
- cout << "x1 is: " << (-b + sqrt(delta)) / (2 * a)<<endl;
- cout << "x2 is: " << (-b - sqrt(delta)) / (2 * a) << endl;
- }
- else if (delta == 0) {
- cout << "x0 is: " << (-b) / (2 * a) << endl;
- }
- else {
- cout << "There are no possible solutions \n";
- }
- cout << "If you want to try again write 'y'. \n";
- cin >> wybor;
- } while (wybor == 'Y' || wybor == 'y');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement