Generated by the communtiy
void chatbot() {
while(true) {
string userinput;
getline(cin, userinput);
if(userinput == "hello")
cout << "Hello!" << endl;
else if(userinput == "why are you so stupid?")
cout << "because i am a bot" << endl;
else
cout << "i dont understand" << endl;
}
}
tmp_file.close
def add(a, b):
print(a)
print(b)
return a + b
add(1, 2)
def main()
principal = 200000
monthly_interest_rate = 0.02
number_of_payments = 24
payment = principal * ((monthly_interest_rate * (1 + monthly_interest_rate)**number_of_payments) / ((1 + monthly_interest_rate)**number_of_payments - 1))
return payment
int add(int a, int b) {
return a + b;
}
int sub(int a, int b) {
return a - b;
}
int main() {
int a = 0, b = 0;
cin >> a;
cin >> b;
cout << add(a, b) << endl;
cout << sub(a, b) << endl;
return 0;
}
def mask_article(text, keyword):
return text.replace(keyword, "*"*len(keyword))
text = "今日のサンプルは金額です"
mask_article(text, "金額")
b <- c(1,1,1,1,1,1,1,0,0,0,0,0,0,0)
while (mean(b) > 0.40) {
b[sample(which(b==1), 1)] <- 0
}
def sql(s):
return s.lower() == "a"
TYPE html>
<html>
<head>
<title>PC Stand</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="container">
<div id="header">
<h1>PC Stand</h1>
</div>
<div id="content">
<h2>About</h2>
<p>
The PC Stand is a project I started in the summer of 2015. I wanted to make a stand for my
def mask_article(text, keyword):
return text.replace(keyword, "*"*len(keyword))
text = "今日のサンプルは金額です"
mask_article(text, "金額")
int main (){
int n=0;
do{
n++;
if (n%2==0)
cout<<n<<endl;
}while(n<=100);
}
def agregar_verdura(lista, verdura):
if verdura not in lista:
lista.append(verdura)
return "{} agregada exitosamente".format(verdura)
else:
return "La verdura ya está en la lista"
verduras = ['lechuga', 'cebolla']
agregar_verdura(verduras, 'tomate')
A = {1,2,3,4,5}
B = {4,5,6,7,8}
A | B
def print_people(people_list):
for p in people_list:
print(p[0], p[1])
print_people(people)
<a href="mailto:+79186788247">+79186788247</a>
the if statement checks the value of dw_hour_meter_value and if the value is greater or equal to the HOUR_METER_MAX then the value of dw_hour_meter_value is set to 0, the gsw_hour_meter_count is set to 0, the fnby_WritePort function is used to write 0 to the AMIL, the fnv_TripA_reset function and the fnv_TripB_reset function are called to reset the trip a and trip b variables.
public class Pila{
int [] pila = new int[10];
int cima = -1;
public void push(int x){
cima++;
pila[cima] = x;
}
public void pop(){
cima--;
}
public boolean empty(){
return cima == -1;
}
public int size(){
return cima+1;
}
public int top(){
return pila[cima];
}
public void ordena(){
for( int i=0; i<pila.length; i++){
for( int j=i+1; j<pila.length; j++){
if(pila[j] < pila[i]){
int t = pila[i];
pila[i] = pila[j];
pila[j] = t;
}
}
}
}
public void imp
def mask_article(text, keyword):
return text.replace(keyword, "*"*len(keyword))
text = "今日のサンプルは金額です"
mask_article(text, "金額")
SELECT string_agg(case data_type
when 'character varying' then 'text'
when 'integer' then 'integer'
when 'double precision' then 'real'
when 'jsonb' then 'jsonb'
end,',') FROM information_schema.columns where table_schema='public' and table_name='customers';
#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;
}
def main()
principal = 200000
monthly_interest_rate = 0.02
number_of_payments = 24
payment = principal * ((monthly_interest_rate * (1 + monthly_interest_rate)**number_of_payments) / ((1 + monthly_interest_rate)**number_of_payments - 1))
return payment
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
}
public static int sum(int a, int b) {
return a + b;
}
DROP PROCEDURE IF EXISTS Premis_Proven_RHY;
DELIMITER //
CREATE PROCEDURE Premis_Proven_RHY(OUT numero_premiat INT)
BEGIN
SET numero_premiat = FLOOR(1 + RAND() * 50);
END //
DELIMITER ;
CALL Premis_Proven_RHY(@premi);
SELECT @premi;
ublic class Date {
public static void main(String[] args) {
int dia, mes, ano;
dia = mes = ano = 0;
Scanner sc = new Scanner(System.in);
System.out.println("Introduce el dia: ");
dia = sc.nextInt();
System.out.println("Introduce el mes:
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
int main()
{
float producto[3][4][12],promedio[4][12];
int i,j,k;
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
for(k=0;k<12;k++)
{
printf("Ingrese venta del producto %d, mes %d, año %d\n",i+1,j+1,k+1);
scanf("%f",&producto[i][j][k]);
}
}
}
for(j=0;j<4;j++)
{
for(k=0;k<12;k++)
{
promedio[j][k]=0;
for(i=0;i<3;i++)
{
promedio[j][k
def reparto(monto):
carolina = 0.8*0.35*monto
diana = 0.35*monto
alfredo = 0.23*(diana + 0.25*monto)
cindy = 0.25*monto
pablo = monto - carolina - diana - alfredo - cindy
return carolina, diana, alfredo, cindy, pablo
reparto(1000)
translateMon, 20 Mar 2023 float volumenEsfera(float radio){
float volumen;
volumen = 4 * M_PI * pow(radio,3) / 3;
return volumen;
}
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)
def main()
principal = 200000
monthly_interest_rate = 0.02
number_of_payments = 24
payment = principal * ((monthly_interest_rate * (1 + monthly_interest_rate)**number_of_payments) / ((1 + monthly_interest_rate)**number_of_payments - 1))
return payment
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非法');
}
SELECT * FROM `order` where ctime between '2017-03-01' and '2017-05-22' and id in (select order_id from order_detail where status = 1 )
const subMenuEl = document.querySelector("#sub-menu")
const mainEl = document.querySelector("#main")
subMenuEl.addEventListener("click", function(event) {
const h1El = document.createElement("h1")
h1El.innerHTML = event.target.innerHTML
mainEl.innerHTML = ""
mainEl.appendChild(h1El)
})
#include <iostream>
using namespace std;
int main() {
int n = 0;
float costo = 0;
cout << "Ingrese la cantidad de pelotas que desea comprar: \n";
cin >> n;
if (n <= 10){
costo = n * 7.00;
cout << "El valor total a pagar es: " << costo << " dolares" << endl;
}
else{
costo = n * 6.50;
cout << "El valor total a pagar es: " << costo << " dolares" << endl;
}
return 0;
}
Script
function createDashboardForm() {
var form = document.createElement('form');
//set form attributes
form.style.padding = '20px';
form.style.border = '1px dashed #000';
form.style.width = '350px';
//create a title
var title = document.createElement('h1');
title.innerHTML = 'Sign up for our newsletter';
//create a description
var description = document.createElement('p');
description.innerHTML = 'Enter your information below to receive our free newsletter.';
//create inputs
var nameInput = document.createElement('input');
nameInput.setAttribute('type', 'text');
nameInput.setAttribute('placeholder', 'Name');
nameInput.style.display = 'block';
nameInput.style.marginBottom = '10px';
var emailInput = document.createElement('input');
emailInput.setAttribute('type', 'email');
emailInput.setAttribute('placeholder', 'Email');
email
public string hillCipher(string key, string plainText)
{
string cipherText = "";
int[] keyInt = key.Select(c => (int)c).ToArray();
int[] plainTextInt = plainText.Select(c => (int)c).ToArray();
int[,] keyMatrix = new int[2, 2];
int[,] plainTextMatrix = new int[2, 1];
keyMatrix[0, 0] = keyInt[0] - 65;
keyMatrix[0, 1] = keyInt[1] - 65;
keyMatrix[1, 0] = keyInt[2] - 65;
keyMatrix[1, 1] = keyInt[3] - 65;
plainTextMatrix[0, 0] = plainTextInt[0] - 65;
plainTextMatrix[1, 0] = plainTextInt[1] - 65;
int[,] cipherTextMatrix = new int[2, 1];
cipherTextMatrix[0, 0] = (keyMatrix[0,
#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;
}
def forward_to_goatse(ip, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('goatse.cx', 80))
s.listen(0)
while 1:
(incoming_socket, address) = s.accept()
incoming_socket.send(b'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<html><body><img src="http://goatse.cx/"></body></html>')
incoming_socket.close()
ublic class Date {
public static void main(String[] args) {
int dia, mes, ano;
dia = mes = ano = 0;
Scanner sc = new Scanner(System.in);
System.out.println("Introduce el dia: ");
dia = sc.nextInt();
System.out.println("Introduce el mes:
DELIMITER //
CREATE PROCEDURE ListProducts()
BEGIN
SELECT * FROM Products
INNER JOIN Categories
ON
Products.categoryID = Categories.categoryID
INNER JOIN Suppliers
ON
Products.supplierID = Suppliers.supplierID
END //
DELIMITER ;
import unittest
class TestCadena(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ['hello', 'world'])
# check that s.split fails when the separator is not a string
with self.assertRaises(TypeError):
s.split(2)
if __name__ == '__main__':
unittest.main()
function lastNonNumber(number) {
var a = number.toString();
var b = a.replace(/\d$/, '');
return parseInt(b);
}
lastNonNumber(2342341)
#
public static Panel CreatePanel()
{
var panel = new Panel();
var textBox = new TextBox();
textBox.Location = new Point(10, 10);
textBox.Size = new Size(200, 50);
panel.Controls.Add(textBox);
var button = new Button();
button.Location = new Point(10, 70);
button.Size = new Size(200, 50);
button.Text = "Execute";
panel.Controls.Add(button);
return panel;
}
private void button1_Click(object sender, EventArgs e)
{
var panel = CreatePanel();
Controls.Add(panel);
}
a = input("a:")
b = input("b:")
if a > b:
print(a)
else:
print(b)
// This is a "stub" file. It's a little start on your solution.
// It's not a complete solution though; you have to write some code.
// Package greeting should have a package comment that summarizes what it's about.
// https://golang.org/doc/effective_go.html#commentary
package greeting
// HelloWorld needs a comment documenting it as package does.
func HelloWorld() string {
return "Hello, World!"
}
void programar(a, z) {
if (a == z)
return a;
}
linkedHashMap.put(key, value)
// This is a "stub" file. It's a little start on your solution.
// It's not a complete solution though; you have to write some code.
// Package greeting should have a package comment that summarizes what it's about.
// https://golang.org/doc/effective_go.html#commentary
package greeting
// HelloWorld needs a comment documenting it as package does.
func HelloWorld() string {
return "Hello, World!"
}
int a, b;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine(a+b);
def mask_article(text, keyword):
return text.replace(keyword, "*"*len(keyword))
text = "今日のサンプルは金額です"
mask_article(text, "金額")
let sql = require('sql')
sql.query(sql.select().from(table).toString())
categories.of.variable <- function(x){
return(length(levels(x)))
}
a = input("a:")
b = input("b:")
if a > b:
print(a)
else:
print(b)
def hipotenusa(a, b):
return a**2 + b**2
hipotenusa(3, 4)
A:
Python 3.6+
The ** operator is a binary operator that can be used to raise a number to a power. It is equivalent to the ** operator in Python 2.7+, but is more readable and more efficient.
>>> 3 ** 2
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;
}
}
#include <iostream>
using namespace std;
int main() {
int n = 0;
float costo = 0;
cout << "Ingrese la cantidad de pelotas que desea comprar: \n";
cin >> n;
if (n <= 10){
costo = n * 7.00;
cout << "El valor total a pagar es: " << costo << " dolares" << endl;
}
else{
costo = n * 6.50;
cout << "El valor total a pagar es: " << costo << " dolares" << endl;
}
return 0;
}
public static int sum(int a, int b) {
return a + b;
}
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非法');
}
def factorial(x):
if x == 0:
return 1
return x * factorial(x - 1)
factorial(5)
The query selects the minimum value of Fees from the table Course and renames it as Course_Fees.
int main() {
string nombre;
cout << "Escribe tu nombre: ";
cin >> nombre;
cout << "Hola " << nombre << "!!" << endl;
return 0;
}
// Список битов с сообщения
// 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
from random import randint
def diceRoll(userGuess, numRoll):
if userGuess == numRoll:
return True
else:
return False
def main():
numRoll = randint(1, 6)
userGuess = int(input("Guess a number from 1 to 6: "))
if diceRoll(userGuess, numRoll):
print("You win!")
else:
print("You lose. Better luck next time!")
main()
def download_file(url):
# download url
# return file_path
return file_path