Загрузить файлы в «/»
This commit is contained in:
48
profit_analysis.cpp
Normal file
48
profit_analysis.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
setlocale(0, "");
|
||||
double profit[12];
|
||||
|
||||
const char* months[12] = {
|
||||
"Сiчень", "Лютий", "Березень", "Квiтень",
|
||||
"Травень", "Червень", "Липень", "Серпень",
|
||||
"Вересень", "Жовтень", "Листопад", "Грудень"
|
||||
};
|
||||
|
||||
cout << "Введiть прибуток фiрми за кожен мiсяць року:" << endl;
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
cout << months[i] << ": ";
|
||||
cin >> profit[i];
|
||||
}
|
||||
|
||||
int maxIndex = 0;
|
||||
for (int i = 1; i < 12; i++) {
|
||||
if (profit[i] > profit[maxIndex]) {
|
||||
maxIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
int minIndex = 0;
|
||||
for (int i = 1; i < 12; i++) {
|
||||
if (profit[i] < profit[minIndex]) {
|
||||
minIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
double totalSum = 0;
|
||||
for (int i = 0; i < 12; i++) {
|
||||
totalSum += profit[i];
|
||||
}
|
||||
|
||||
cout << "\nРезультати аналiзу:" << endl;
|
||||
cout << "Мiсяць з максимальним прибутком: " << months[maxIndex]
|
||||
<< " (прибуток: " << profit[maxIndex] << ")" << endl;
|
||||
cout << "Мiсяць з мiнiмальним прибутком: " << months[minIndex]
|
||||
<< " (прибуток: " << profit[minIndex] << ")" << endl;
|
||||
cout << "Загальна сума прибутку за рiк: " << totalSum << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
37
range_checker.cpp
Normal file
37
range_checker.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int a;
|
||||
int b;
|
||||
int x;
|
||||
|
||||
cout << "Введiть нижню межу дiапазону: ";
|
||||
cin >> a;
|
||||
|
||||
cout << "Введiть верхню межу дiапазону: ";
|
||||
cin >> b;
|
||||
|
||||
if (a > b) {
|
||||
int temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
cout << "Границi помiняно мiсцями. Дiапазон: [" << a << ", " << b << "]" << endl;
|
||||
}
|
||||
|
||||
do {
|
||||
cout << "Введiть число для перевiрки: ";
|
||||
cin >> x;
|
||||
|
||||
if (x < a || x > b) {
|
||||
cout << "Число " << x << " не потрапляє в дiапазон ["
|
||||
<< a << ", " << b << "]" << endl;
|
||||
}
|
||||
|
||||
} while (x < a || x > b);
|
||||
|
||||
cout << "Вiдмiнно! Число " << x << " потрапляє в дiапазон ["
|
||||
<< a << ", " << b << "]" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
29
remove_digits.cpp
Normal file
29
remove_digits.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int number;
|
||||
int newNumber = 0;
|
||||
int multiplier = 1;
|
||||
|
||||
cout << "Введiть цiле число: ";
|
||||
cin >> number;
|
||||
|
||||
int originalNumber = number;
|
||||
|
||||
while (number > 0) {
|
||||
int digit = number % 10;
|
||||
|
||||
if (digit != 3 && digit != 6) {
|
||||
newNumber = newNumber + digit * multiplier;
|
||||
multiplier *= 10;
|
||||
}
|
||||
|
||||
number = number / 10;
|
||||
}
|
||||
|
||||
cout << "Введене число: " << originalNumber << endl;
|
||||
cout << "Нове число (без цифр 3 i 6): " << newNumber << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
24
sum_calculator.cpp
Normal file
24
sum_calculator.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int number;
|
||||
int sum = 0;
|
||||
|
||||
cout << "Введите числа (введите 0 для завершения):" << endl;
|
||||
|
||||
cout << "Введите число: ";
|
||||
cin >> number;
|
||||
|
||||
while (number != 0) {
|
||||
sum += number;
|
||||
cout << "Текущая сумма: " << sum << endl;
|
||||
|
||||
cout << "Введите число: ";
|
||||
cin >> number;
|
||||
}
|
||||
|
||||
cout << "Итоговая сумма: " << sum << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
168
task2.cpp
168
task2.cpp
@@ -1,86 +1,82 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
setlocale(0, "");
|
||||
int l;
|
||||
int q;
|
||||
int c = 0;
|
||||
|
||||
srand(time(0));
|
||||
|
||||
cout << "=== ПЕРЕВiРКА ТАБЛИЦi МНОЖЕННЯ ===" << endl;
|
||||
cout << "Оберiть рiвень складностi:" << endl;
|
||||
cout << "1) Легкий (1-5, 5 питань)" << endl;
|
||||
cout << "2) Середнiй (1-10, 7 питань)" << endl;
|
||||
cout << "3) Важкий (1-15, 10 питань)" << endl;
|
||||
cout << "Введiть номер рiвня (1-3): ";
|
||||
cin >> l;
|
||||
|
||||
switch(l) {
|
||||
case 1:
|
||||
q = 5;
|
||||
cout << "\n=== ЛЕГКИЙ РiВЕНЬ ===" << endl;
|
||||
break;
|
||||
case 2:
|
||||
q = 7;
|
||||
cout << "\n=== СЕРЕДНiЙ РiВЕНЬ ===" << endl;
|
||||
break;
|
||||
case 3:
|
||||
q = 10;
|
||||
cout << "\n=== ВАЖКИЙ РiВЕНЬ ===" << endl;
|
||||
break;
|
||||
default:
|
||||
cout << "Невiрний вибiр!" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= q; i++) {
|
||||
int a;
|
||||
int b;
|
||||
int ans;
|
||||
int user;
|
||||
|
||||
if (l == 1) {
|
||||
a = rand() % 5 + 1;
|
||||
b = rand() % 5 + 1;
|
||||
} else if (l == 2) {
|
||||
a = rand() % 10 + 1;
|
||||
b = rand() % 10 + 1;
|
||||
} else {
|
||||
a = rand() % 15 + 1;
|
||||
b = rand() % 15 + 1;
|
||||
}
|
||||
|
||||
ans = a * b;
|
||||
|
||||
cout << "\nПитання " << i << "/" << q << ": " << a << " * " << b << " = ";
|
||||
cin >> user;
|
||||
|
||||
if (user == ans) {
|
||||
cout << "Правильно! +1 бал" << endl;
|
||||
c++;
|
||||
} else {
|
||||
cout << "Неправильно! Правильна вiдповiдь: " << ans << endl;
|
||||
}
|
||||
}
|
||||
|
||||
cout << "\n=== РЕЗУЛЬТАТИ ===" << endl;
|
||||
cout << "Правильних вiдповiдей: " << c << " з " << q << endl;
|
||||
|
||||
double p = (double)c / q * 100;
|
||||
|
||||
if (p >= 90) {
|
||||
cout << "Оцiнка: ВiДМiННО! (5)" << endl;
|
||||
} else if (p >= 80) {
|
||||
cout << "Оцiнка: ДОБРЕ (4)" << endl;
|
||||
} else if (p >= 70) {
|
||||
cout << "Оцiнка: ЗАДОВiЛЬНО (3)" << endl;
|
||||
} else {
|
||||
cout << "Оцiнка: НЕЗАДОВiЛЬНО (2)" << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int level;
|
||||
int questions;
|
||||
int correct = 0;
|
||||
|
||||
srand(time(0));
|
||||
|
||||
cout << "=== ПЕРЕВIРКА ТАБЛИЦI МНОЖЕННЯ ===" << endl;
|
||||
cout << "Оберiть рiвень складностi:" << endl;
|
||||
cout << "1) Легкий (1-5, 5 питань)" << endl;
|
||||
cout << "2) Середнiй (1-10, 7 питань)" << endl;
|
||||
cout << "3) Важкий (1-15, 10 питань)" << endl;
|
||||
cout << "Введiть номер рiвня (1-3): ";
|
||||
cin >> level;
|
||||
|
||||
switch(level) {
|
||||
case 1:
|
||||
questions = 5;
|
||||
cout << "\n=== ЛЕГКИЙ РIВЕНЬ ===" << endl;
|
||||
break;
|
||||
case 2:
|
||||
questions = 7;
|
||||
cout << "\n=== СЕРЕДНIЙ РIВЕНЬ ===" << endl;
|
||||
break;
|
||||
case 3:
|
||||
questions = 10;
|
||||
cout << "\n=== ВАЖКИЙ РIВЕНЬ ===" << endl;
|
||||
break;
|
||||
default:
|
||||
cout << "Невiрний вибiр!" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= questions; i++) {
|
||||
int a, b, answer, userAnswer;
|
||||
|
||||
if (level == 1) {
|
||||
a = rand() % 5 + 1;
|
||||
b = rand() % 5 + 1;
|
||||
} else if (level == 2) {
|
||||
a = rand() % 10 + 1;
|
||||
b = rand() % 10 + 1;
|
||||
} else {
|
||||
a = rand() % 15 + 1;
|
||||
b = rand() % 15 + 1;
|
||||
}
|
||||
|
||||
answer = a * b;
|
||||
|
||||
cout << "\nПитання " << i << "/" << questions << ": " << a << " * " << b << " = ";
|
||||
cin >> userAnswer;
|
||||
|
||||
if (userAnswer == answer) {
|
||||
cout << "Правильно! +1 бал" << endl;
|
||||
correct++;
|
||||
} else {
|
||||
cout << "Неправильно! Правильна вiдповiдь: " << answer << endl;
|
||||
}
|
||||
}
|
||||
|
||||
cout << "\n=== РЕЗУЛЬТАТИ ===" << endl;
|
||||
cout << "Правильних вiдповiдей: " << correct << " з " << questions << endl;
|
||||
|
||||
double percentage = (double)correct / questions * 100;
|
||||
|
||||
if (percentage >= 90) {
|
||||
cout << "Оцiнка: ВIДМIННО! (5)" << endl;
|
||||
} else if (percentage >= 80) {
|
||||
cout << "Оцiнка: ДОБРЕ (4)" << endl;
|
||||
} else if (percentage >= 70) {
|
||||
cout << "Оцiнка: ЗАДОВIЛЬНО (3)" << endl;
|
||||
} else {
|
||||
cout << "Оцiнка: НЕЗАДОВIЛЬНО (2)" << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user