Generated by the communtiy
#include <iostream>
using namespace std;
int menu(){
int option;
cout << "1. Sumar dos numeros.\n";
cout << "2. Restar dos numeros.\n";
cout << "3. Multiplicar dos numeros.\n";
cout << "4. Dividir dos numeros.\n";
cout << "5. Número Primo?.\n";
cout << "6. Salir.\n";
cout << "Ingrese opción: ";
cin >> option;
return option;
}
int suma(int a, int b){
return a+b;
}
int resta(int a, int b){
return a-b;
}
int multiplicacion(int a, int b){
return a*b;
}
int division(int a, int b){
if (b == 0){
return 0;
}
return a/b;
}
// no es una funcion real
add(Mensaje)
{
// almacenar mensajes en una lista
var mensajes = [];
// si el mensaje es de esa persona contestar
if mensaje.persona == "alguna":
mensaje.respond("hola");
}
}
public class Movimiento
{
public bool MovimientoBasico(int[] posicion, int[] destino)
{
if ( destino == posicion )
{
return false;
}
else if ( destino[0] >= posicion[0] )
{
posicion[0] ++;
}
else if ( destino[0] <= posicion[0] )
{
posicion[0] --;
}
else if ( destino[1] >= posicion[1] )
{
posicion[1] ++;
}
else if ( destino[1] <= posicion[1] )
{
posicion[1] --;
}
else
{
return false;
}
return true;
}
}
//in MainTransactionForm.Xaml.cs
public partial class MainTransactionForm : Form
{
public MainTransactionForm()
{
InitializeComponent();
}
private void withdrawButton_Click(object sender, EventArgs e)
{
LoginForm loginForm = new LoginForm();
loginForm.WithdrawChecking();
}
}
//in LoginForm.Xaml.cs
class LoginForm
{
public void WithdrawChecking()
{
if(true)
{
MessageBox.Show("withdraw checking");
}
}
}
function Dice() {
this.value = 0;
this.numberOfThrows = 0;
this.renderTo = "";
}
Dice.prototype.render = function () {
document.querySelector(this.renderTo).innerHTML = this.value;
};
Dice.prototype.throw = function () {
this.numberOfThrows++;
this.value = Math.ceil(Math.random() * 6);
};
Dice.prototype.getNumberOfThrows = function () {
return this.numberOfThrows;
};
Dice.prototype.getValue = function () {
return this.value;
};
def salario(salario_base):
if salario_base >= 500000 and salario_base <= 1000000:
return salario_base + (salario_base * 0.2)
else:
return salario_base
salario(500000)
salario(80000)
translateThu, 23 Mar 2023 #include <stdio.h>
int main(int argc, char const *argv[])
{
int n;
printf("Ingrese tamaño del arreglo: \n");
scanf("%d", &n);
int numbers[n];
for (int i = 0; i < n; i++)
{
printf("Ingrese un numero: \n");
scanf("%d", &numbers[i]);
}
for (int i = 0; i < n; i++)
{
printf("El numero %d es: %d \n", i, numbers[i]);
}
return 0;
}
/^\d{8}[a-zA-Z]$/
func round(input float64) float64 {
return math.Floor(input*1000) / 1000
}
unction of the human body is to maintain homeostasis. The body is constantly adapting to the environment and to the internal environment. The body is constantly adapting to the environment and to the internal environment. The body is constantly adapting to the environment and to the internal environment. The body is constantly
def sql(s):
return s.lower() == "a"
def hack_instagram(username):
nclude <iostream>
using namespace std;
int add(int a, int b) {
return a + b;
}
int main() {
int a = add(1, 2);
cout << a << endl;
return 0;
}
A:
The problem is that you are using the same variable name for the function and the variable. You need to use different names for
function isPrime(num) {
if (num === 2) {
return true;
} else if (num > 1) {
for (var i = 2; i < num; i++) {
if (num % i !== 0) {
return true;
}
}
}
return false;
}
console.log(isPrime(10))
function Add(a, b) {
console.log(a + b)
}
Add(1, 2)
# Add a rectangle
color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255) )
pygame.draw.rect(screen, color, [random.randint(0, 200), random.randint(0, 200), 50, 50])
vehiculos = []
def grabar(tipo, patente, marca, precio, multa_monto, multa_fecha, reg_fecha, dueño):
vehiculos.append([tipo, patente, marca, precio, multa_monto, multa_fecha, reg_fecha, dueño])
def buscar(patente):
for vehiculo in vehiculos:
if vehiculo[1] == patente:
print(vehiculo)
return True
return False
int main(int argc, char** argv) {
// Create a file reader
cv::VideoCapture cap;
// Open the video file
cap.open(0);
// Create a window to display the video
cv::namedWindow("Video");
// Show the image in the window
cv::imshow("Video", video);
// Wait for the user to press a button
cv::waitKey(0);
}
def invoice(name, amount, **kwargs):
print(f"Name={name} Amount={amount}")
for k,v in kwargs.items():
print(f"{k} : {v}")
invoice("Paula", 100, tax=0.16, tip=1.2)
#LMM
library(lme4)
m2 <- clm(categorical_FOD_FODs ~ 0 + Condition_FODs:Language_used_FODs - 1, random = ~1|subject, data = indvar_FODs)
summary(m2)
#LM
m2 <- clm(categorical_FOD_FODs ~ Condition_FODs:Language_used_FODs - 1, data = indvar_FODs)
summary(m2)
#post-hoc analysis
library(lsmeans)
contrast(m2, "pairwise", list(Condition_FODs = c("A", "B", "C", "D")))
library(emmeans)
emmeans(m2, pairwise~Condition_FODs, adjust = "bonferroni")
def even(x):
if x == 1 or x == 0:
return False
else:
return even(x - 2)
even(3)
def backtest_aapl(window):
b = backtesting.Backtest(aapl['Close'], aapl['Close'].rolling(window).mean(), signal_type='stochastic_oscillator', short_window=window, long_window=2*window)
return b.signal
//in MainTransactionForm.Xaml.cs
public partial class MainTransactionForm : Form
{
public MainTransactionForm()
{
InitializeComponent();
}
private void withdrawButton_Click(object sender, EventArgs e)
{
LoginForm loginForm = new LoginForm();
loginForm.WithdrawChecking();
}
}
//in LoginForm.Xaml.cs
class LoginForm
{
public void WithdrawChecking()
{
if(true)
{
MessageBox.Show("withdraw checking");
}
}
}
unction of the human body is to maintain homeostasis. The body is constantly adapting to the environment and to the internal environment. The body is constantly adapting to the environment and to the internal environment. The body is constantly adapting to the environment and to the internal environment. The body is constantly
# -*- coding: utf-8 -*-
# Copyright (c) 2019, DigiThinkIT and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ProductDetector(Document):
pass
function Dice() {
this.value = 0;
this.numberOfThrows = 0;
this.renderTo = "";
}
Dice.prototype.render = function () {
document.querySelector(this.renderTo).innerHTML = this.value;
};
Dice.prototype.throw = function () {
this.numberOfThrows++;
this.value = Math.ceil(Math.random() * 6);
};
Dice.prototype.getNumberOfThrows = function () {
return this.numberOfThrows;
};
Dice.prototype.getValue = function () {
return this.value;
};
func round(input float64) float64 {
return math.Floor(input*1000) / 1000
}
SELECT SUM(Total) FROM Orders WHERE OrderDate LIKE "1998-01-%" AND EmployeeID=5;
private void extract_Click(object sender, EventArgs e)
{
string input = data.Text;
string[] parts = input.Split(',');
foreach (string part in parts)
{
listBox1.Items.Add(part);
}
}
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
}
php
class Calculadora {
private $operacion;
private $operando1;
private $operando2;
private $operando3;
private $operando4;
private $operando5;
private $operando6;
private $operando7;
private $operando8;
private $operando9;
private $operando10;
private $operando
def drawArrow(turtle, size):
for i in range(0, 4):
turtle.forward(size)
turtle.right(90)
drawArrow(turtle, 100)
function saludo(idioma) {
switch (idioma) {
case 'aleman':
return 'Guten Tag!';
case 'mandarin':
return 'Ni Hao!';
case 'ingles':
return 'Hello!';
default:
return 'Hola!';
}
}
SELECT SUM(Total) FROM Orders WHERE OrderDate LIKE "1998-01-%" AND EmployeeID=5;
df = pd.read_csv("/home/oscar/Documentos/python/data.csv")
df.head()
df['Nivel'].value_counts().plot(kind="bar", color=["green", "blue", "red"])
plt.xlabel("Nivel")
plt.ylabel("Frecuencia")
plt.title("Diagrama de barras")
plt.show()
docstringFri, 10 Feb 2023 def add(a, b):
"""Returns the sum of a and b."""
return a + b
#LMM
library(lme4)
m2 <- clm(categorical_FOD_FODs ~ 0 + Condition_FODs:Language_used_FODs - 1, random = ~1|subject, data = indvar_FODs)
summary(m2)
#LM
m2 <- clm(categorical_FOD_FODs ~ Condition_FODs:Language_used_FODs - 1, data = indvar_FODs)
summary(m2)
#post-hoc analysis
library(lsmeans)
contrast(m2, "pairwise", list(Condition_FODs = c("A", "B", "C", "D")))
library(emmeans)
emmeans(m2, pairwise~Condition_FODs, adjust = "bonferroni")
#include <stdio.h>
int main(void) {
int N;
scanf("%d", &N);
int estaturas[N];
for (int i = 0; i < N; i++) {
scanf("%d", &estaturas[i]);
}
int posicion;
scanf("%d", &posicion);
printf("%d", estaturas[posicion]);
return 0;
}
def get_fanels(img, gt, mask, nlabels):
fanels = []
for i in range(nlabels):
fanel = img.copy()
fanel[gt != i] = 0
fanel = fanel * mask
fanels.append(fanel)
return np.array(fanels)
int main() {
string nombre;
cout << "Escribe tu nombre: ";
cin >> nombre;
cout << "Hola " << nombre << "!!" << endl;
return 0;
}
A = 1
B = 3
C = 0
S = A
if B > S then S = B
if C > S then S = C
if A > S then A = S
if B > S then B = S
if C > S then C = S
if A > S then A = S
if B > S then B = S
if C > S then C = S
if A > S then A = S
if B > S then B = S
if C > S then C = S
print S
function checkValidOrderIdOnly(s)
{
let len = s.length;
if (len !== 17) throw new Error('参数错误,orderid非法');
let v = parseInt(s);
if (!Number.isFinite(v))
throw new Error('参数错误,orderid非法');
let d = new Date(v);
if (d.getTime() !== v)
throw new Error('参数错误,orderid非法');
let now = Date.now();
if (v > now || v < now - 24 * 60 * 60 * 1000)
throw new Error('参数错误,orderid非法');
}
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
@Component({
name: "Masonry",
})
export default class GridLayout extends Vue {
@Prop({ default: false })
horizontal!: boolean;
@Prop({ default: 200 })
gutter!: number;
@Prop({ default: 0 })
column!: number;
@Prop({ default: null })
minWidth!: number | null;
@Prop({ default: null })
maxWidth!: number | null;
@Prop({ default: null })
breakpoint!: number | null;
@Prop({ default: true })
transition!: boolean;
@Prop({ default: "fade" })
transitionMode!: string;
@Prop({ default: 300 })
transitionDuration!: number;
private $slots = this.$slots;
private $props = this.$props;
private currentWidth: number = 0;
private currentGutterSize: number = 0;
private transitionDurationStyle
++
#include<stdio.h>
#include<stdlib.h>
int main()
{
int opcion;
do
{
printf("1. if \n");
printf("2. if else\n");
printf("3. for\n");
printf("4. while \n");
printf("5. do while \n");
printf("6. salir \n");
scanf("%d",&opcion);
switch(opcion)
{
case 1:
printf("Usted eligio la opcion if");
break;
case 2:
printf("Usted eligio la opcion if else");
break;
case 3:
printf("Usted eligio la opcion for");
break;
case 4:
printf("Usted eligio la opcion while");
break;
case 5:
printf("Usted eligio la opcion do while");
break;
case 6:
printf("Usted eligio la opcion salir");
break;
default:
printf("opcion invalida");
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
return 0;
}
#
public double IVA(double subtotal)
{
return subtotal * 0.16;
}
SELECT name, year, war FROM database WHERE (war WHERE year=2002)+(war WHERE year=2003)>5
The regex matches the first bracket, then any character, then any number of characters, then a comma.
/*
Tema: Presentacion de animal
Autor: @ricardoifc
*/
String[] frases = {
"Bienvenidos a mi presentación.",
"Hoy les voy a hablar de gatos",
"Los gatos son animales muy inteligentes."
};
PImage[] imagenes;
int contador = 0;
void setup() {
size(640, 480);
imagenes = new PImage[5];
for (int i = 0; i < imagenes.length; i++) {
String numero = str(i+1);
imagenes[i] = loadImage("gato" + numero + ".jpg");
}
}
void draw() {
background(0);
image(imagenes[contador], 0, 0);
textFont(createFont("Arial", 32));
fill(255);
text(frases[contador], 40, 40, 600, 400);
}
void mousePressed() {
import os
def speak(text):
os.system(f'powershell.exe -Command "Add-Type -AssemblyName System.speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak(\'{text}\');"')
speak('Test')
Script
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})
readline.question(`dime cuantas filas quieres`, (rows) => {
readline.question(`dime cuantas columnas quieres`, (columns) => {
console.log(`Vamos a crear una matriz de ${rows} filas y ${columns} columnas`)
let matrix = createMatrix(rows, columns)
printMatrix(matrix)
let minInfo = getMin(matrix)
console.log(`El minimo es: ${minInfo.value} y está en las posiciones (${minInfo.i}, ${minInfo.j})`)
let maxInfo = getMax(matrix)
console.log(`El maximo es: ${maxInfo.value} y está en las posiciones (${maxInfo.i}, ${maxInfo.j})`)
readline.close()
Ship::Ship(ShipType type,const std::vector<Coordinate *> &positions)
{
this->type = type;
this->positions = positions;
}
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
}
#include <stdio.h>
int main(void) {
int N;
scanf("%d", &N);
int estaturas[N];
for (int i = 0; i < N; i++) {
scanf("%d", &estaturas[i]);
}
int posicion;
scanf("%d", &posicion);
printf("%d", estaturas[posicion]);
return 0;
}
/^\d{8}[a-zA-Z]$/
#include<iostream>
#include<string>
using namespace std;
int main(){
int n;
cout<<"enter number: ";
cin>>n;
string str = to_string(n);
cout<<str<<endl;
cout<<"sum is: ";
int sum = 0;
for(int i = 0; i < str.length(); i += 2){
string s;
s += str[i];
s += str[i+1];
sum += stoi(s);
}
cout<<sum<<endl;
}
// Список битов с сообщения
// 1 бит - стартовый бит (1)
// 2 - 8 бит - биты сообщения (7 бит)
// 9 бит - бит паритета (должен быть равен чётности всех битов сообщения)
// 10 бит - стоп-бит (0)
char start_bit = 1;
char message_bit_1 = 0;
char message_bit_2 = 0;
char message_bit_3 = 0;
char message_bit_4 = 1;
char message_bit_5 = 0;
char message_bit_6
#include <iostream>
int main() {
int suma = 0;
for (int i = 0; i < 200; ++i) {
if(i % 2 != 0)
suma += i;
}
std::cout << suma << std::endl;
return 0;
}
#include <math.h>
#include <graphics.h>
#include <iostream>
using namespace std;
int main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
int x1, y1, x2, y2;
x1 = 50;
y1 = 50;
int n;
cout << "ingrese el numero de cuadrados:";
cin >> n;
cout << "ingrese el lado del cuadrado";
cin >> x2;
y2 = x2;
for (int i = 1; i <= n; i++)
{
rectangle(x1, y1, x2, y2);
x1 = x1 - 10;
y1 = y1 - 10;
x2 = x2 + 20;
y2 = y2 + 20;
}
getch();
<html>
<head>
<script>
function promedio(n1,n2,n3){
var resultado;
resultado = n1+n2+n3;
return resultado;
}
</script>
</head>
<body>
<div class="container" id="main">
<script>
document.write(promedio(3,5,7));
</script>
</div>
</body>
</html>
#include <stdio.h>
#include <pthread.h>
void *thread_func(void *arg) {
printf("New thread created\n");
return NULL;
}
int main() {
pthread_t tid;
pthread_create(&tid, NULL, thread_func, NULL);
pthread_join(tid, NULL);
return 0;
}
UPDATE Projects SET name = TRIM(name);