1
0
This commit is contained in:
2024-05-23 18:54:11 +03:00
parent 6fcee9ce9b
commit f6806d8a5a
2 changed files with 22 additions and 5 deletions

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Books Information</title> <title>Лабораторная работа No6</title>
<style> <style>
table { table {
border-collapse: collapse; border-collapse: collapse;
@@ -176,7 +176,7 @@
tableBody.appendChild(row); tableBody.appendChild(row);
}); });
const json = JSON.stringify(books); const json = JSON.stringify(books, null, 2);
document.getElementById("json").value = json; document.getElementById("json").value = json;
} }

View File

@@ -42,6 +42,11 @@
<button onclick="run()">Выполнить</button> <button onclick="run()">Выполнить</button>
</div> </div>
<div>
<h3>Результат:</h3>
<div id="result"></div>
</div>
<script src="script.js"></script> <script src="script.js"></script>
<script> <script>
function run() { function run() {
@@ -74,15 +79,27 @@
func = countCalls(func); func = countCalls(func);
characteristics = []; characteristics = [];
if (isFindMin) names = []
if (isFindMin) {
characteristics.push(findMin); characteristics.push(findMin);
if (isCountPositive) names.push('Минимум');
}
if (isCountPositive) {
characteristics.push(countPositive); characteristics.push(countPositive);
if (isIsMonotonous) names.push('Кол-во положительных');
}
if (isIsMonotonous) {
characteristics.push(isMonotonous); characteristics.push(isMonotonous);
names.push('Монотонность');
}
const chars = calculateCharacteristics(func, Number(xMin), Number(xMax), Number(h), characteristics); const chars = calculateCharacteristics(func, Number(xMin), Number(xMax), Number(h), characteristics);
console.log(chars); console.log(chars);
const result = document.getElementById('result');
names.forEach((name, index) => {
result.innerHTML += name + ': ' + chars[index] + '<br>';
})
} }
</script> </script>
</body> </body>