-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
h1{ | ||
font-family: 'Gotham'; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
h3{ | ||
font-family: 'Gotham'; | ||
} | ||
|
||
.calculator { | ||
max-width: 300px; | ||
margin: auto; | ||
padding: 20px; | ||
background-color: #ffffff; | ||
border-radius: 8px; | ||
box-shadow: 0 0 40px 20px rgba(0, 0, 0, 0.1); | ||
text-align: center; | ||
} | ||
|
||
.calculator input, | ||
select { | ||
width: 80%; | ||
padding: 10px; | ||
margin-bottom: 10px; | ||
border: 1px solid #cccccc; | ||
border-radius: 4px; | ||
} | ||
|
||
button { | ||
padding: 10px 20px; | ||
background-color: #8a2be2; | ||
color: #ffffff; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #9932cc; | ||
} | ||
|
||
|
||
|
||
.resultado{ | ||
font-family: 'Gotham'; | ||
font-weight: bold; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
max-width: 300px; | ||
margin: auto; | ||
padding: 20px; | ||
background-color: #ffffff; | ||
border-radius: 8px; | ||
box-shadow: 0 0 40px 20px rgba(0, 0, 0, 0.1); | ||
text-align: center; | ||
} | ||
|
||
p{ | ||
font-family: 'Gotham'; | ||
font-weight: bold; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="css/styles.css"> | ||
<title>Calculadora PHP</title> | ||
</head> | ||
<body> | ||
<div> | ||
<h1>CALCULDORA</h1> | ||
</div> | ||
<div class="divc"> | ||
<form class="calculator" action="operacoes.php" method="get"> | ||
<h3>Calculadora Quatro Operações</h3> | ||
<div class="caixatexto"> | ||
<input type="text" id="number1" name="number1" placeholder="Number 1" /> | ||
<input type="text" id="number2" name="number2" placeholder="Number 2" /> | ||
</div> | ||
<select id="operacao" class="select" name="operacao"> | ||
<option> </option> | ||
<option value="Soma">Soma</option> | ||
<option value="Subtracao">Subtracao</option> | ||
<option value="Divisao">Divisao</option> | ||
<option value="Multiplicacao">Multiplicacao</option> | ||
<option value="Raiz">Radiciação</option> | ||
<option value="Potencia">Potênciação</option> | ||
</select> | ||
<button type="submit" class="calcular">Calcular</button> | ||
</form> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="css/styles.css"> | ||
<title>Calculadora PHP</title> | ||
</head> | ||
|
||
<body> | ||
|
||
<?php | ||
$operacao = $_GET["operacao"]; | ||
$number1 = $_GET["number1"]; | ||
$number2 = $_GET["number2"]; | ||
$resultado = []; | ||
|
||
switch ($operacao) { | ||
case 'Soma': | ||
$resultado = $number1 + $number2; | ||
break; | ||
case 'Subtracao': | ||
$resultado = $number1 - $number2; | ||
break; | ||
case 'Divisao': | ||
if ($number2 == 0) { | ||
echo "<p>Não é possível dividir por 0.</p>"; | ||
} else { | ||
$resultado = $number1 / $number2; | ||
} | ||
break; | ||
case 'Multiplicacao': | ||
$resultado = $number1 * $number2; | ||
break; | ||
case 'Potencia': | ||
$resultado = $number1 ** $number2; | ||
break; | ||
case 'Raiz': | ||
$resultado = $number1 ** (1 / $number2); | ||
break; | ||
default: | ||
echo "<p>Insira os valores.</p>"; | ||
} | ||
|
||
?> | ||
|
||
<div class="resultado"> | ||
<p>Resultado: | ||
<?php echo $resultado; ?> | ||
</p> | ||
</div> | ||
<p><a href="index.php">Voltar</a></p> | ||
|
||
</body> | ||
|
||
</html> |