diff options
Delete pract_SI directory
9 files changed, 0 insertions, 296 deletions
| -rw-r--r-- | pract_SI/pract. 02/Tasks_2.txt | 37 | ||||
| -rw-r--r-- | pract_SI/pract. 02/task1.cpp | 20 | ||||
| -rw-r--r-- | pract_SI/pract. 02/task2.cpp | 29 | ||||
| -rw-r--r-- | pract_SI/pract. 02/task3 - no EPSILON.cpp | 23 | ||||
| -rw-r--r-- | pract_SI/pract. 02/task3 - with EPSILON.cpp | 24 | ||||
| -rw-r--r-- | pract_SI/pract. 02/task4.cpp | 26 | ||||
| -rw-r--r-- | pract_SI/pract. 02/task5.cpp | 51 | ||||
| -rw-r--r-- | pract_SI/pract. 02/task6.cpp | 42 | ||||
| -rw-r--r-- | pract_SI/pract. 02/task7.cpp | 44 |
diff --git a/pract_SI/pract. 02/Tasks_2.txt b/pract_SI/pract. 02/Tasks_2.txt deleted file mode 100644 index a419241..0000000 --- a/pract_SI/pract. 02/Tasks_2.txt +++ /dev/null @@ -1,37 +0,0 @@ -#Никола Светославов - task2 - -## Задачи - -1. Напишете програма,която проверява дали въведена от потребителя година е високосна. - **Проверете сами кои години се считат за високосни** - -2. Напишете програма, която приема един символ от входа и проверява дали: - - * този символ е буква от латинската азбука; - * ако да, дали тази буква е гласна или съгласна. - - **Програмата да работи както за малки, така и за главни букви** - -3. Напишете програма, която приема две **различни** числа и казва кое е по голямо. - **Използвайте тернарен оператор** - -4. Напишете програма, която приема от входа три числа - страни на триъгълник. - Програмата да проверява дали това е валиден триъгълник. - -5. Напишете програма, която намира корените на квадратно уравнение. - За целта потребителя да въведе коефицентите на уравнението - *a*, *b*, и *c* - при уравнение с вид *a \* x^2 + b \* x + c = 0*. - -6. Напишете прост калкулатор, който поддържа операциите +, -, *, / на две реални числа. - **Внимавайте с делението на 0** - -7. Да се състави програма, чрез която се въвежда 4-цифренo естествено число от интервала [1000.. 9999]. - От това число се формират 2 нови 2-цифрени числа. Първото число се формира от 1-та и 4-та цифра на въведеното - число. Второто число се формира от 2-рa - 3-та цифра на въведеното число.На екрана да се изведе дали - 1-то ново число e по-малко <, равно = или по-голямо от 2-то число. - Използвайте проверка на логическо условие - оператор if. - //Задачата е взета от [тук](http://1001zadachi.com/оператор_if_сравняване_числа.html). - - **Пример: 3332 Изход: less (32<33) - **Пример: 1144 Изход: equal (14=14) - **Пример: 9875 Изход: greater (95>87) diff --git a/pract_SI/pract. 02/task1.cpp b/pract_SI/pract. 02/task1.cpp deleted file mode 100644 index 3a60fad..0000000 --- a/pract_SI/pract. 02/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/task2.cpp b/pract_SI/pract. 02/task2.cpp deleted file mode 100644 index a1ddcf8..0000000 --- a/pract_SI/pract. 02/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/task3 - no EPSILON.cpp b/pract_SI/pract. 02/task3 - no EPSILON.cpp deleted file mode 100644 index 6c9f832..0000000 --- a/pract_SI/pract. 02/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/task3 - with EPSILON.cpp b/pract_SI/pract. 02/task3 - with EPSILON.cpp deleted file mode 100644 index dcd5f88..0000000 --- a/pract_SI/pract. 02/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/task4.cpp b/pract_SI/pract. 02/task4.cpp deleted file mode 100644 index acb471c..0000000 --- a/pract_SI/pract. 02/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/task5.cpp b/pract_SI/pract. 02/task5.cpp deleted file mode 100644 index 419d6d4..0000000 --- a/pract_SI/pract. 02/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/task6.cpp b/pract_SI/pract. 02/task6.cpp deleted file mode 100644 index a7484b2..0000000 --- a/pract_SI/pract. 02/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/task7.cpp b/pract_SI/pract. 02/task7.cpp deleted file mode 100644 index 3c22a83..0000000 --- a/pract_SI/pract. 02/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 |
