diff options
Delete pract_SI directory
39 files changed, 0 insertions, 1149 deletions
diff --git a/pract_SI/Pract. 01/Solutions/task1.cpp b/pract_SI/Pract. 01/Solutions/task1.cpp deleted file mode 100644 index 54a1902..0000000 --- a/pract_SI/Pract. 01/Solutions/task1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include<iostream> -#include<string> -using namespace std; -int main() -{ - string name; - cout << "What is your name?\n"; - cin >> name; - cout << "Hello, " << name << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 01/Solutions/task2.cpp b/pract_SI/Pract. 01/Solutions/task2.cpp deleted file mode 100644 index 554653d..0000000 --- a/pract_SI/Pract. 01/Solutions/task2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - double x, y; - - cout << "First side: "; - cin >> x; - - cout << "Second side: "; - cin >> y; - - cout << "Parameter: " << 2 * (x + y) << endl; - cout << "Area: " << x * y << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 01/Solutions/task3.cpp b/pract_SI/Pract. 01/Solutions/task3.cpp deleted file mode 100644 index 830348b..0000000 --- a/pract_SI/Pract. 01/Solutions/task3.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - double a, b; - - cout << "First number: "; - cin >> a; - - cout << "Second number: "; - cin >> b; - - cout << boolalpha << (a < b) << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 01/Solutions/task4.cpp b/pract_SI/Pract. 01/Solutions/task4.cpp deleted file mode 100644 index b4829b4..0000000 --- a/pract_SI/Pract. 01/Solutions/task4.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include<iostream> -#include<cmath> -using namespace std; -int main() -{ - double x1, y1, x2, y2; - - cout << "x1: "; - cin >> x1; - - cout << "y1: "; - cin >> y1; - - cout << "x2: "; - cin >> x2; - - cout << "y2: "; - cin >> y2; - - cout << round(sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) * 100) / 100 << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 01/Solutions/task5.cpp b/pract_SI/Pract. 01/Solutions/task5.cpp deleted file mode 100644 index 931178d..0000000 --- a/pract_SI/Pract. 01/Solutions/task5.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include<iostream> -#include<string> -#include<iomanip> -using namespace std; -int main() -{ - string card_number; - - cout << "Card number: "; - cin >> card_number; - - cout << "Hidden card number: " << setfill('X') << setw(13) - << card_number[12] << card_number[13] << card_number[14] << card_number[15] << endl; - - return 0; -}
\ No newline at end of file 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 diff --git a/pract_SI/Pract. 03/Solutions/task1.cpp b/pract_SI/Pract. 03/Solutions/task1.cpp deleted file mode 100644 index ae955a8..0000000 --- a/pract_SI/Pract. 03/Solutions/task1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "pch.h" -#include <iostream> - -using namespace std; - -int main() -{ - unsigned long long number; - cin >> number; - - for (int i = 1; i <= number; i++) - { - for (int j = 1; j <= i; j++) - cout << j; - cout << endl; - } - - return 0; -} diff --git a/pract_SI/Pract. 03/Solutions/task2.cpp b/pract_SI/Pract. 03/Solutions/task2.cpp deleted file mode 100644 index b3e970d..0000000 --- a/pract_SI/Pract. 03/Solutions/task2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include <iostream> - -using namespace std; - -int main() -{ - unsigned long long number; - cin >> number; - - for (unsigned long long x = 1, y = number; x < number; x++) - { - cout << "x = " << x << " " - << "y = " << --y << endl; - } - - return 0; -} diff --git a/pract_SI/Pract. 03/Solutions/task3.cpp b/pract_SI/Pract. 03/Solutions/task3.cpp deleted file mode 100644 index a6a6362..0000000 --- a/pract_SI/Pract. 03/Solutions/task3.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - unsigned long long oldNumber, newNumber; - - cout << "Enter a positive number: "; - cin >> oldNumber; - - oldNumber *= oldNumber; - newNumber = 0; - - while (oldNumber != 0) - { - newNumber = newNumber * 10 + oldNumber % 10; - oldNumber /= 10; - } - - cout << newNumber << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 03/Solutions/task4.cpp b/pract_SI/Pract. 03/Solutions/task4.cpp deleted file mode 100644 index 622b8a1..0000000 --- a/pract_SI/Pract. 03/Solutions/task4.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - unsigned int m, n; - cout << "Number of rows: "; - cin >> m; - cout << "Number of columns: "; - cin >> n; - - for (unsigned int i = 1; i <= m * n; i++) - { - cout << i << " "; - if (i % n == 0) - { - cout << endl; - } - } - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 03/Solutions/task5.cpp b/pract_SI/Pract. 03/Solutions/task5.cpp deleted file mode 100644 index d6ac57c..0000000 --- a/pract_SI/Pract. 03/Solutions/task5.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - unsigned short number, guess; - unsigned int counter = 0; - - cout << "Enter a number between 0 and 100: "; - cin >> number; - if (number < 0 || number > 100) - { - cout << "Invalid input!\n"; - return 1; - } - - do - { - ++counter; - - cout << "Guess " << counter << ": "; - cin >> guess; - if (guess < 0 || guess > 100) - { - cout << "Invalid input!\n"; - return 2; - } - - if (guess < number) - { - cout << "The number you are looking for is greater than your guess!\n"; - } - else if (guess > number) - { - cout << "The number you are looking for is less than your guess!\n"; - } - } while (guess != number); - - cout << "You found the number in " << counter << " attempt(s)!\n"; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 03/Solutions/task6.cpp b/pract_SI/Pract. 03/Solutions/task6.cpp deleted file mode 100644 index 8d0beac..0000000 --- a/pract_SI/Pract. 03/Solutions/task6.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - unsigned int number = 0, input = 1; - - while(input != 0) - { - cout << "Enter a positive number: "; - cin >> input; - - number ^= input; - } - - cout << "The single number is " << number << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 03/Solutions/task7.cpp b/pract_SI/Pract. 03/Solutions/task7.cpp deleted file mode 100644 index aa9194b..0000000 --- a/pract_SI/Pract. 03/Solutions/task7.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include <iostream> -#define LIMIT 5 -#define SEPARATOR " " - -using namespace std; - -//const short LIMIT = 5; -//const char SEPARATOR = ' '; - - -int main() -{ - unsigned long long N; - cin >> N; - - if (N < LIMIT) - return -1; - - for (int c = 1; c <= N; c++) { - for (int b = 1; b < c; b++) { - for (int a = 1; a < b; a++) { - if ((a * a) + (b * b) == (c * c)) { - cout << a << SEPARATOR << b << SEPARATOR << c << endl; - } - } - } - } - - return 0; -} diff --git a/pract_SI/Pract. 03/Solutions/task8.cpp b/pract_SI/Pract. 03/Solutions/task8.cpp deleted file mode 100644 index 3f32ebf..0000000 --- a/pract_SI/Pract. 03/Solutions/task8.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include <iostream> - -using namespace std; - -const short LOWERLIMIT = 2; -const short UPPERLIMIT = 9; -const char SEPARATOR = ' '; - -int main() -{ - short N; - char S; - cin >> N >> S; - - if (N < LOWERLIMIT || N > UPPERLIMIT) - return -1; //end program - - for (int i = 1; i <= N; i++) - { - for (int j = N - i; j > 0; j--) - cout << SEPARATOR; - - for (int k = 1; k < 2 * i; k++) - cout << S; - - cout << endl; - } - - for (int i = 1; i < N; i++) - { - for (int j = 1; j <= i; j++) - cout << SEPARATOR; - - for (int k = 1; k < 2 * (N - i); k++) - cout << S; - - cout << endl; - } - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 03/Solutions/task9.cpp b/pract_SI/Pract. 03/Solutions/task9.cpp deleted file mode 100644 index 9f1f054..0000000 --- a/pract_SI/Pract. 03/Solutions/task9.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include <iostream> - -int main() { - - // по-нататък ще учим как се вкарват сложни данни, затова сега ще ги hardcode-нем в main-а - - int hoursOnesStart = 2, minutesTensStart = 5, secondsOnesStart = 6; - int hoursOnesFinal = 1, minutesTensFinal = 0, secondsOnesFinal = 2; - int hoursDelta = 10, minutesDelta = 19, secondsDelta = 26; - - for (size_t hoursTensStart = 0; hoursTensStart <= 1; ++hoursTensStart) - { - for (size_t minutesOnesStart = 0; minutesOnesStart <= 9; ++minutesOnesStart) - { - for (size_t secondsTensStart = 0; secondsTensStart <= 5; secondsTensStart++) - { - int hoursTemp = hoursTensStart * 10 + hoursOnesStart; - int minutesTemp = minutesTensStart * 10 + minutesOnesStart; - int secondsTemp = secondsTensStart * 10 + secondsOnesStart; - - secondsTemp += secondsDelta; - if (secondsTemp >= 60) { - minutesTemp += secondsTemp / 60; - secondsTemp %= 60; - } - - minutesTemp += minutesDelta; - if (minutesTemp >= 60) { - hoursTemp += minutesTemp / 60; - minutesTemp %= 60; - } - - hoursTemp += hoursDelta; - if (hoursTemp > 12) { - hoursTemp %= 12; - } - - bool hoursOnesMatch = hoursTemp % 10 == hoursOnesFinal, - minutesTensMatch = minutesTemp / 10 == minutesTensFinal, - secondsOnesMatch = secondsTemp % 10 == secondsOnesFinal; - - if (hoursOnesMatch && minutesTensMatch && secondsOnesMatch) { - int hoursTensFinal = hoursTemp / 10, - minutesOnesFinal = minutesTemp % 10, - secondsTensFinal = secondsTemp / 10; - - std::cout << hoursTensStart << hoursOnesStart << ':' - << minutesTensStart << minutesOnesStart << ':' - << secondsTensStart << secondsOnesStart << ' ' - << hoursTensFinal << hoursOnesFinal << ':' - << minutesTensFinal << minutesOnesFinal << ':' - << secondsTensFinal << secondsOnesFinal << '\n'; - } - } - } - } - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/Pract. 03/Startup_tasks.txt b/pract_SI/Pract. 03/Startup_tasks.txt deleted file mode 100644 index 8ee6d58..0000000 --- a/pract_SI/Pract. 03/Startup_tasks.txt +++ /dev/null @@ -1,7 +0,0 @@ -1.Напишете програма , която приема като вход N лева.Да се отпечата как бихме разпределили сумата на банкноти, -така че да имаме минимален брой банкноти. (Да не се използват условни оператори и цикли) -Пояснение: Нека да приемем, че имаме банкноти с 1лв и 2лв. - -2.Напишете програма, която приема като вход цяло положително число V, което ще отговаря на скорост. -Програмата да отпечатва колко е глобата от КАТ, а ако няма глоба следното съобщение "No speedticket". -(https://stamatovandpartners.com/elektronen-fish-za-previshena-skorost/)
\ No newline at end of file diff --git a/pract_SI/Pract. 03/Tasks3.txt b/pract_SI/Pract. 03/Tasks3.txt deleted file mode 100644 index 64c5c4c..0000000 --- a/pract_SI/Pract. 03/Tasks3.txt +++ /dev/null @@ -1,131 +0,0 @@ -#Никола Светославов - task3 - -## Задачи - -1.Да се напише програма, която приема естествено число n и изписва стълба от 1 до n - -Пример -Вход: -5 -Изход: -1 -12 -123 -1234 -12345 - -2.Да се състави програма, която по въведено естествено число n да изведе всички естествени решения на уравнението x + y = n. - -Пример -Вход: -4 -Изход: -x = 1 y = 3 -x = 2 y = 2 -x = 3 y = 1 - - -3.Напишете програма, която по въведено цяло положително число, извежда квадратът на това число, но в обратен ред, като водещите нули се игнорират. - -Пример -Вход: -10 -Изход: -1 - -Вход: -25 -Изход: -526 - -4.Напишете програма, която приема от потребителя две цели положителни числа - *m* и *n*. - Програмата да отпечата числатаот 1 до m*n, като на всеки ред има по *n* числа (тоест ще отпечатате *m* реда). - Печатайте числата по редове: - -Пример -Вход: -2 3 -Изход: -1 2 3 -4 5 6 - -5.Напишете проста игра, в която първо се въвежда цяло число в интервала [0;100] и в последствие се въвеждат цели числа - (предположения), като за всяко се казва дали е по - малко или по - голямо от първоначално ваведеното. - Tова продължава до въвеждане на число, равно на първоначалното. Програмата да отпечата и броят направени предположения. - -6.Напишете програма, която иска от потребителя поредица от цели числа по - големи от 0. - Въвеждането приключва с въвеждане на 0. Гарантирано е, че всяко от числата е въведено **точно два пъти** освен едно, - което е въведено **точно веднъж**. Програмата да изведе кое е това число. - -7.Да се състави програма, която по въведено естествено число N намира и отпечатва всички тройки естествени числа a, b и c, - не по-големи от N, които могат да бъдат страни на правоъгълен триъгълник. - -Пример -Вход: -11 -Изход -3 4 5 -6 8 10 - -8.Напишете програма, която иска от потребителя вход цифра N[2;9] и символ S.Програмата да извежда фигура съставена от символа във вид на ромб, както е показано на примерите. - -Пример -Вход: -5 * -Изход - * - *** - ***** - ******* -********* - ******* - ***** - *** - * - -*Бонус* -Задача ЕЛЕКТРОНЕН ЧАСОВНИК -В големия нов МОЛ в града на програмистите се повредили част от цифрите на електронния часовник. -Повредени били първата цифра от числото, което показва часовете, втората цифра на числото, което показва минутите и първата цифра на числото, което показва секундите. -Вместо тях на екрана се появявал знака *. -Когато Коко и приятелите му ходели на кино, те не успявали да преценят точно колко е часа. -Все пак, момчетата си създали система за изчисление, която приблизително точно им показвало времето. -Те успявали да предвидят колко е показвал часовника в началото и края на филма, в случай че знаят точно колко време е минало. -Срещу името на всеки филм на входа на киното е дадено неговото времетраене в часове, минути и секунди. -Пресмятанията доста затрудняват момчетата и затова на тях ще им е по-удобно това да се прави с компютърна програма. -Те не разбират много от програмиране и затова вие трябва да напишете програма clock, която помага на Коко и приятелите му. - -Вход: -На първия ред на стандартния вход е записана последователност от цифри и знака *, която показва какво се вижда на екрана на часовника в началото на филма. -На втория ред е записана подобна последователност за показанието на часовника в края на филма. -На третия ред се въвежда продължителността на филма в часове, минути и секунди. -Часовникът е настроен така, че показва времето по 12-часова скала, а не по 24-часова. - -Изход: -На стандартния изход изведете всички възможни показания на часовника за началото и края на филма. -Всяка двойка с начален и краен час се извежда на един ред, като първо се извежда началното показание във формат hh:mm:ss, и след един интервал крайното показание в същия формат. -Ако такива показания на часовника не са възможни, да се изведе “Impossible”. - -Ограничения: -Продължителността на филма е не по-голяма 12 часа. - -Примери: - -Вход: -*25**6 -*10**2 -10 19 26 -Изход: -02:50:06 01:09:32 -02:50:16 01:09:42 -02:50:26 01:09:52 -12:50:06 11:09:32 -12:50:16 11:09:42 -12:50:26 11:09:52 - -Вход: -*95**6 -*21**2 -4 12 6 -Изход: -Impossible diff --git a/pract_SI/pract. 01/Tasks_1.txt b/pract_SI/pract. 01/Tasks_1.txt deleted file mode 100644 index bb7ee2d..0000000 --- a/pract_SI/pract. 01/Tasks_1.txt +++ /dev/null @@ -1,20 +0,0 @@ -Никола Светославов - task1 - -## Задачи -1.Напишете програма, която пита потребителя за името му, след което отпечатва "Hello, <име>" - -2.Напишете програма, която подканя потребителя да въведе дължините на двете страни на правоъгълник - **като му извежда съобщение, например "Please enter the length of the first side:"** - Програмата да изведе периметърът и лицето на този правоъгълник. - **Страните може да не са цели числа!** - -3.Напишете програма, която взима две числа от стандартния вход и извежда *true* ако първото е по - малко от второто - и *false* в противен случай. - -4.Напишете програма, която приема от входа две двойки реални числа, отговарящи на две точки в равнината. - Да се отпечата растоянието между точките закръглено до 2-рия знак след десетичната запетая. - **Потърсете математическата формула в интернет ако не я знаете!** - -БОНУС:Напишете програма която приема номер на кредитна карта(16 цифри). - Програмата да изведе същият този номер, но със скрити първите 12 цифри (XXXXXXXXXXXX1234). -БОНУС:**Направете го без да записвате X-ове променлива и без да правите ```cout<<"XXXXXXXXXXXX"``` :)** diff --git a/pract_SI/pract. 01/task1.cpp b/pract_SI/pract. 01/task1.cpp deleted file mode 100644 index 54a1902..0000000 --- a/pract_SI/pract. 01/task1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include<iostream> -#include<string> -using namespace std; -int main() -{ - string name; - cout << "What is your name?\n"; - cin >> name; - cout << "Hello, " << name << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/pract. 01/task2.cpp b/pract_SI/pract. 01/task2.cpp deleted file mode 100644 index 554653d..0000000 --- a/pract_SI/pract. 01/task2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - double x, y; - - cout << "First side: "; - cin >> x; - - cout << "Second side: "; - cin >> y; - - cout << "Parameter: " << 2 * (x + y) << endl; - cout << "Area: " << x * y << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/pract. 01/task3.cpp b/pract_SI/pract. 01/task3.cpp deleted file mode 100644 index 830348b..0000000 --- a/pract_SI/pract. 01/task3.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include<iostream> -using namespace std; -int main() -{ - double a, b; - - cout << "First number: "; - cin >> a; - - cout << "Second number: "; - cin >> b; - - cout << boolalpha << (a < b) << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/pract. 01/task4.cpp b/pract_SI/pract. 01/task4.cpp deleted file mode 100644 index b4829b4..0000000 --- a/pract_SI/pract. 01/task4.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include<iostream> -#include<cmath> -using namespace std; -int main() -{ - double x1, y1, x2, y2; - - cout << "x1: "; - cin >> x1; - - cout << "y1: "; - cin >> y1; - - cout << "x2: "; - cin >> x2; - - cout << "y2: "; - cin >> y2; - - cout << round(sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) * 100) / 100 << endl; - - return 0; -}
\ No newline at end of file diff --git a/pract_SI/pract. 01/task5.cpp b/pract_SI/pract. 01/task5.cpp deleted file mode 100644 index 576bf2e..0000000 --- a/pract_SI/pract. 01/task5.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include<iostream> -#include<string> -#include<iomanip> -using namespace std; -int main() -{ - string card_number;; - - cout << "Card number: "; - cin >> card_number; - - cout << "Hidden card number: " << setfill('X') << setw(13) - << card_number[12] << card_number[13] << card_number[14] << card_number[15] << endl; - - return 0; -}
\ No newline at end of file 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 |
