diff options
Delete pract_SI directory
8 files changed, 0 insertions, 259 deletions
| -rw-r--r-- | pract_SI/Pract. 02/Solutions/task1.cpp | 20 | ||||
| -rw-r--r-- | pract_SI/Pract. 02/Solutions/task2.cpp | 29 | ||||
| -rw-r--r-- | pract_SI/Pract. 02/Solutions/task3 - no EPSILON.cpp | 23 | ||||
| -rw-r--r-- | pract_SI/Pract. 02/Solutions/task3 - with EPSILON.cpp | 24 | ||||
| -rw-r--r-- | pract_SI/Pract. 02/Solutions/task4.cpp | 26 | ||||
| -rw-r--r-- | pract_SI/Pract. 02/Solutions/task5.cpp | 51 | ||||
| -rw-r--r-- | pract_SI/Pract. 02/Solutions/task6.cpp | 42 | ||||
| -rw-r--r-- | pract_SI/Pract. 02/Solutions/task7.cpp | 44 |
diff --git a/pract_SI/Pract. 02/Solutions/task1.cpp b/pract_SI/Pract. 02/Solutions/task1.cpp deleted file mode 100644 index 3a60fad..0000000 --- a/pract_SI/Pract. 02/Solutions/task1.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - int year; - - cout << "Enter an year to check: "; - cin >> year; - - cout << year << " is"; - - if (!(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))) - { - cout << " not"; - } - - cout << " leap!\n"; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 02/Solutions/task2.cpp b/pract_SI/Pract. 02/Solutions/task2.cpp deleted file mode 100644 index a1ddcf8..0000000 --- a/pract_SI/Pract. 02/Solutions/task2.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - char inputCharacter; - - cout << "Enter a character to test: "; - cin >> inputCharacter; - - cout << inputCharacter << " is "; - if (inputCharacter == 'a' || inputCharacter == 'e' || inputCharacter == 'i' || inputCharacter == 'o' || inputCharacter == 'u' || - inputCharacter == 'A' || inputCharacter == 'E' || inputCharacter == 'I' || inputCharacter == 'O' || inputCharacter == 'U') - { - cout << "a vowel!\n"; - } - else - { - if ((inputCharacter >= 'a' && inputCharacter <= 'z') || (inputCharacter >= 'A' && inputCharacter <= 'Z')) - { - cout << "a consonant!\n"; - } - else - { - cout << "is not a letter from the English alphabet!\n"; - } - } - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 02/Solutions/task3 - no EPSILON.cpp b/pract_SI/Pract. 02/Solutions/task3 - no EPSILON.cpp deleted file mode 100644 index 6c9f832..0000000 --- a/pract_SI/Pract. 02/Solutions/task3 - no EPSILON.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include<iostream> -#include<cmath> -using namespace std; -int main() -{ - double x, y; - - cout << "Enter the first number: "; - cin >> x; - - cout << "Enter the second number: "; - cin >> y; - - if (fabs(x - y) < 0.000001) - { - cout << "Numbers must be different!\n"; - return 1; - } - - cout << (x < y ? y : x) << " is the greater number!\n"; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 02/Solutions/task3 - with EPSILON.cpp b/pract_SI/Pract. 02/Solutions/task3 - with EPSILON.cpp deleted file mode 100644 index dcd5f88..0000000 --- a/pract_SI/Pract. 02/Solutions/task3 - with EPSILON.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include <iostream> -#include <cmath> -using namespace std; - -int main() -{ - double num1, num2; - - cout << "Enter the first number: "; - cin >> num1; - - cout << "Enter the second number: "; - cin >> num2; - - if (fabs(num1 - num2) <= DBL_EPSILON * fabs(num1)) - { - cout << "Numbers must be different!\n"; - return 1; - } - - cout << (num1 > num2 ? "First" : "Second") << " is the greater number!\n"; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 02/Solutions/task4.cpp b/pract_SI/Pract. 02/Solutions/task4.cpp deleted file mode 100644 index acb471c..0000000 --- a/pract_SI/Pract. 02/Solutions/task4.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - double a, b, c; - - cout << "First side: "; - cin >> a; - - cout << "Second side: "; - cin >> b; - - cout << "Third side: "; - cin >> c; - - if ((a + b > c) && (a + c > b) && (b + c > a)) - { - cout << "Triangle is valid.\n"; - } - else - { - cout << "Triangle is not valid.\n"; - } - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 02/Solutions/task5.cpp b/pract_SI/Pract. 02/Solutions/task5.cpp deleted file mode 100644 index 419d6d4..0000000 --- a/pract_SI/Pract. 02/Solutions/task5.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include<iostream> -#include<cmath> -using namespace std; -int main() -{ - double a, b, c; - double root1, root2, imaginary; - double discriminant; - - cout << "Finding the root of the equation a * x^2 + b * x + c = 0\n"; - - cout << "Enter the value of a: "; - cin >> a; - - if (a < 0.00000001) - { - cout << "If a is 0, then this is not a quadratic equation!\n"; - return 1; - } - - cout << "Enter the value of b: "; - cin >> b; - - cout << "Enter the value of c: "; - cin >> c; - - discriminant = (b * b) - (4 * a * c); - - if (discriminant > 0) - { - root1 = (-b + sqrt(discriminant)) / (2 * a); - root2 = (-b - sqrt(discriminant)) / (2 * a); - - cout << "Two distinct and real roots exist: " << root1 << " and " << root2 << endl; - } - else if (discriminant == 0) - { - root1 = root2 = -b / (2 * a); - - cout << "Two equal and real roots exist: " << root1 << " and " << root2 << endl; - } - else if (discriminant < 0) - { - root1 = root2 = -b / (2 * a); - imaginary = sqrt(-discriminant) / (2 * a); - - cout << "Two distinct complex roots exist: " << root1 << "+" << imaginary << "i and " << root2 << "-" << imaginary << "i\n"; - } - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 02/Solutions/task6.cpp b/pract_SI/Pract. 02/Solutions/task6.cpp deleted file mode 100644 index a7484b2..0000000 --- a/pract_SI/Pract. 02/Solutions/task6.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - double a, b; - char operation; - - cout << "Enter the first number: "; - cin >> a; - - cout << "Enter the second number: "; - cin >> b; - - cout << "Choose operation: +, -, / or *: "; - cin >> operation; - - switch (operation) - { - case '+': - cout << "Result: " << a + b << endl; - break; - case '-': - cout << "Result: " << a - b << endl; - break; - case '*': - cout << "Result: " << a * b << endl; - break; - case '/': - if (b < 0.0000001) - { - cout << "You can not divide by zero!\n"; - return 1; - } - cout << "Result: " << a / b << endl; - break; - default: - cout << "Invalid operation!\n"; - break; - } - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 02/Solutions/task7.cpp b/pract_SI/Pract. 02/Solutions/task7.cpp deleted file mode 100644 index 3c22a83..0000000 --- a/pract_SI/Pract. 02/Solutions/task7.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - // you can use int as well, but do you really need something as big as int? - short number; - unsigned char digit1, digit2, digit3, digit4, number1, number2; - - cout << "Enter a 4-digit number: "; - cin >> number; - - if (number < 1000 || number > 10000) - { - cout << "The input must be a 4-digit number!\n"; - return 1; - } - - digit1 = number / 1000; - digit2 = number / 100 % 10; - digit3 = number / 10 % 10; - digit4 = number % 10; - - number1 = digit1 * 10 + digit4; - number2 = digit2 * 10 + digit3; - - if (number1 < number2) - { - cout << "less (" << (int)number1 << " < " << (int)number2 << ")\n"; - } - else - { - if (number1 == number2) - { - cout << "equal (" << (int)number1 << " = " << (int)number2 << ")\n"; - } - else - { - cout << "greater (" << (int)number1 << " > " << (int)number2 << ")\n"; - } - } - - - return 0; -}
\ No newline at end of file |
