NOSSO MENU

sábado, 26 de dezembro de 2020

Calculadora em JavaScript pegando os elementos por ID

 <!DOCTYPE html>

<html>

<h1>NOSSO APLICATIVO CALCULADORA!</h1>

<head>

<h3>NOSSO PRIMEIRO APP</h3>

<style>

h1 {

  color: red;

  text-align: center;

}

h3 {

  color: blue;

  text-align: center;

}

</style>

<script>


function soma(){

    var x = document.getElementById("x").value;// com .value vc pega o valor do ide 

var y = document.getElementById("y").value;

var r = parseInt(x) + parseInt(y);/// parseInt converte pra inteiro

document.getElementById("r").value = r;

}

function sub(){

var x = document.getElementById("x").value;// com .value vc pega o valor do ide 

var y = document.getElementById("y").value;

var r = parseInt(x) - parseInt(y);

document.getElementById("r").value = r;

}

function mult(){

var x = document.getElementById("x").value;

var y = document.getElementById("y").value;

var r = parseInt(x) * parseInt(y);

document.getElementById("r").value = r;

}

function div(){

var x = document.getElementById("x").value;// com .value vc pega o valor do ide 

var y = document.getElementById("y").value;

var r = parseInt(x) / parseInt(y);

document.getElementById("r").value = r;

}

</script>

<body>


<div id = "principal">

<form id="form">

<!-- ESSES BUTÕES PARA NA TELA-->

<input id="x" type="text"/>

<input id="somar" type= "button" value="Somar" onclick="soma()"/>

<input id="subtrair" type= "button" value="Sub" onclick="sub()"/>

<input id="multiplicar" type= "button" value="Mult" onclick="mult()"/>

<input id="dividir" type= "button" value="Div" onclick="div()"/>

<input id="y" type="text"/>

<input id="limpar" type="reset" value="Resetar"/>

<!--

<button onclick="soma()">SOMA</button>  esse é so um clic

<button onclick="sub()">SUBTRAÇÃO</button>

<button onclick="mult()">MULTIPLICAÇÃO</button>

<button onclick="div()">DIVISÃO</button>

-->

<b>=</b>

<input id="r" type="text"/ disabled="true">

</form>

</div>


</body>

</head>

</html>

sexta-feira, 25 de dezembro de 2020

Calculadora simples em JavaSscript

 <!DOCTYPE html>

<html>

<h1>NOSSO APLICATIVO CALCULADORA!</h1>

<head>

<h3>NOSSO PRIMEIRO APP</h3>

<style>

h1 {

  color: red;

  text-align: center;

}

h3 {

  color: blue;

  text-align: center;

}

</style>

<script>

/* mostra resultados na tela 

alert(x);

alert("ola"); //popup

document.write(y); //mostra na tela/ escreve no html

document.write(sub(1,2)); // subtração

opcoes para mostrar na tela: 

Writing into an HTML element, using innerHTML.

Writing into the HTML output using document.write().

Writing into an alert box, using window.alert().

Writing into the browser console, using console.log().

*/

// classes POO

// escolhe a opção e os numeros para as operaçoes

// op =1, op =2, op = 3, op = 4. x=x e y = y


class calc {

constructor(x, y){

this.x = x;

this.y = y;

}

soma(){

return this.x + this.y;

}

sub(){

return this.x + this.y;

}

mult(){

return this.x + this.y;

}

div(){

return this.x + this.y;

}

}


// Usando SWITCH EM JavaScript

var text;

var opcao = prompt("Qual é a opcao(soma, sub, mult, div)");

//var opcao = document.write("Qual é a opcao: ");

switch(opcao) {

  case "soma":

    var x = parseInt(prompt("digite o numero X")); //parseInt converte para inteiro

var y = parseInt(prompt("digite o numero Y"));

    resultados = new calc(x,y);

    //document.write(soma);

    document.write(resultados.soma());

    break;

  case "sub":

    var x = parseInt(prompt("digite o numero X")); //parseInt converte para inteiro

var y = parseInt(prompt("digite o numero Y"));

    resultados = new calc(x,y);

    //document.write(soma);

    document.write(resultados.sub());

    break;

  case "mult":

    var x = parseInt(prompt("digite o numero X")); //parseInt converte para inteiro

var y = parseInt(prompt("digite o numero Y"));

    resultados = new calc(x,y);

    //document.write(soma);

    document.write(resultados.mult());

    break;

  case "div":

    var x = parseInt(prompt("digite o numero X")); //parseInt converte para inteiro

var y = parseInt(prompt("digite o numero Y"));

    resultados = new calc(x,y);

    //document.write(soma);

    document.write(resultados.div());

break;

  default:

    //text = "I have never heard of that one..";

}


// APLICACAO DA NOSSA CLASSE

//resultados = new calc(2,4);

//document.write(soma);

//document.write(resultados.soma());

//alert(resultados.soma); // alert mostra o resultado

</script>

</head>

</html>

Usando classe em JavaScript

 <!DOCTYPE html>

<html>

<h1> escripts js</h1>

<script>


// classes em javascript


class soma_sub {

constructor(x, y){

this.x = x;

this.y = y;

}

soma(){

return this.x + this.y;

}

}



// aplicando a classe


result = new soma_sub(5,7);

document.write(result.soma());


</script>

<body>

</body>

</html>

terça-feira, 22 de dezembro de 2020

As Linguagens de Programação Mais Usadas Atualmente Java, C, C++, Python, C#, JavaScript, Visual Basic .NET, R, PHP, MATLAB, Swift, Objective-C, Assembly, Perl, Ruby, Delphi , Object Pascal, Go, Scratch, PL/SQL, Visual Basic.

 

As Linguagens de Programação Mais Usadas Atualmente

Java,

 C,

 C++,

 Python, 

C#, 

JavaScript,

 Visual Basic .NET, 

R, 

PHP,

 MATLAB, 

Swift,

 Objective-C, 

Assembly, 

Perl,

 Ruby, 

Delphi ,

Object Pascal, 

Go, 

Scratch, 

PL/SQL,

Visual Basic.


linguagem programação estranha Whitespace Olá mundo ou Hello World!

 linguagem programação estranha

Whitespace

Olá mundo ou Hello World!
S S S T	S S T	S S S L
T	L
S S S S S T	T	S S T	S T	L
T	L
S S S S S T	T	S T	T	S S L
T	L
S S S S S T	T	S T	T	S S L
T	L
S S S S S T	T	S T	T	T	T	L
T	L
S S S S S T	S T	T	S S L
T	L
S S S S S T	S S S S S L
T	L
S S S S S T	T	T	S T	T	T	L
T	L
S S S S S T	T	S T	T	T	T	L
T	L
S S S S S T	T	T	S S T	S L
T	L
S S S S S T	T	S T	T	S S L
T	L
S S S S S T	T	S S T	S S L
T	L
S S S S S T	S S S S T	L
T	L
S S L
L
L

Redes Sociais

anuncios