Custom ChatGPT Plugin development

ConversAI Solutions

Code faster with the help of AI

Generate code just by typing a text description. AI will create the code for you. Test it now

Questions about programming?Chat with your personal AI assistant

How others used it recently

Generated by the communtiy

generate functionTue, 25 Apr 2023

suponga que el precio unitario de las pelotas de baseball es de 6.50 dolares si se compran 10 o mas y 7.00 dolares en caso de comprar menos. imprima no solo el costo sino tambien el mensaje descuento o el mensaje sin descuento

#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; }

C++
Guest
generate functionSun, 23 Apr 2023

conectarse a una base de datos llamada FeedLot de sql en la direccion 192.168.0.20, con nombre de usario root y contraseña admin, este codigo debe ser en python, despues que accesa debe entrar a una p...

import mysql.connector conecction = mysql.connector.connect(host = '192.168.0.20', user = 'root', password = 'admin', database = 'FeedLot') cursor = conecction.cursor() def menu(): print("***************************************") print("* 1. Archivo: *") print("* 2. Reporte: *") print("* 3. Consulta: *") print("* 4. Salir: *") print("***************************************") def submenu(): print("***************************************") print("* 1. Reporte semanal: *") print("* 2. Reporte mensual: *") print("* 3. Reporte anual: *") print("* 4. Salir: *") print("***************************************") def crearReporte(): print("***************************************") print("* 1. Reporte semanal: *") print("

Python
Guest
generate functionSat, 06 May 2023

Identifique la realizacion de un modo alternado de los procesos ("PROC1" , "PROC1"y "PROC2" de forma indefinida.

Script function processes(arr) { var obj = {}; var p1_count = 0; var p2_count = 0; var a = 0; var b = 0; for (var i = 0; i < arr.length; i++) { if (arr[i] === "PROC1") { p1_count += 1; a = p1_count; } else { p2_count += 1; b = p2_count; } if (a === b) { obj[arr[i]] = b; a = 0; b = 0; } } return obj; } processes(["PROC1", "PROC1", "PROC1", "PROC2", "PROC2", "PROC2"]);

Java
Guest
generate functionWed, 24 May 2023

make a get API with response "Test"."Test" word should come from mysql DB and Admin portal should also be there which should be linked with DB to change the word and host on heroku or any Hosting site.

// 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!" }

Javascript
Guest
generate functionFri, 21 Apr 2023

標準入力から 2 つの整数を入力し、大きいほうの値を表示するプログラムを作成せよ。 (ヒント:2 つの変数を a、b とすると、a>b が「正しいとき」と「正しくないとき」でそれぞれどちらを表 示すればよいかが判断できるはずである。もし両者が同じ値のときは、a と b のどちらを表示してもよい)

a = input("a:") b = input("b:") if a > b: print(a) else: print(b)

Java
Guest
generate functionMon, 12 Dec 2022

get a list of users from active directory from police department, output to spreadsheet, order column by name

def get_police_users(department): import ldap import re from openpyxl import Workbook from openpyxl import load_workbook wb = Workbook() ws = wb.active # connect to active directory conn = ldap.initialize('ldap://ldap.yourdomain.com') # search for users in department in active directory results = conn.search_s('dc=yourdomain,dc=com', ldap.SCOPE_SUBTREE, "department=" + department, ['cn']) # create spreadsheet and add users in department to it ws.append(["Users"]) for result in results: ws.append([re.findall('(?<=cn=).*', result[1]['cn'][0].decode('utf-8'))[0]]) wb.save("output.xlsx") # open spreadsheet and sort by last name wb = load

Python
Guest
generate functionSun, 30 Apr 2023

Implementar una Calculadora de Números Enteros, mediante un proyecto de consola en C++, cuyo algoritmo permita: 1. Mostrar un menú de 6 opciones: • 1. Sumar dos números. • 2. Restar dos números. • 3. ...

#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; }

C++
Guest
generate functionWed, 12 Apr 2023

Realizar un script en Python que calcule las resistencias en paralelo o en serie, pidiendo primero la cantidad de resistencias, luego el tipo de conexión en formato string si es en “serie” o en “paral...

def serie(resistencias): total = 0 for resistencia in resistencias: total += resistencia return total def paralelo(resistencias): total = 0 for resistencia in resistencias: if resistencia == 0: return 0 total += 1 / resistencia return 1 / total def total(resistencias, tipo): if tipo == "serie": return serie(resistencias) elif tipo == "paralelo": return paralelo(resistencias) else: print("Tipo de resistencia no reconocida") return None resistencias = [] while True: cantidad = int(input("Ingrese la cantidad de resistencias: ")) if cantidad > 0: break print("Ingrese una cantidad positiva") for i in range(cantidad): while True:

Python
Guest
generate functionSat, 06 May 2023

Identifique la realizacion de un modo alternado de los procesos ("PROC1" , "PROC1"y "PROC2" de forma indefinida.

Script function processes(arr) { var obj = {}; var p1_count = 0; var p2_count = 0; var a = 0; var b = 0; for (var i = 0; i < arr.length; i++) { if (arr[i] === "PROC1") { p1_count += 1; a = p1_count; } else { p2_count += 1; b = p2_count; } if (a === b) { obj[arr[i]] = b; a = 0; b = 0; } } return obj; } processes(["PROC1", "PROC1", "PROC1", "PROC2", "PROC2", "PROC2"]);

Java
Guest
generate functionThu, 27 Jul 2023

La automotora “Auto Seguro” necesita registrar todos los datos de los vehículos que en este periodo tienen a la venta. En el registro de vehículos que pertenece a la región metropolitana de Santiago d...

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

Python
Guest
testsSat, 22 Apr 2023

Crear un código de una calculadora

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()

Guest
generate functionSun, 04 Dec 2022

Offline speak function for windows

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')

Python
Guest
generate functionMon, 08 May 2023

Write a C program to implement Caesar cipher encryption-decryption

#include <stdio.h> int main() { char message[100], ch; int i, key; printf("Enter a message to encrypt: "); gets(message); printf("Enter key: "); scanf("%d", &key); for(i = 0; message[i] != '\0'; ++i){ ch = message[i]; if(ch >= 'a' && ch <= 'z'){ ch = ch + key; if(ch > 'z'){ ch = ch - 'z' + 'a' - 1; } message[i] = ch; } else if(ch >= 'A' && ch <= 'Z'){ ch = ch + key; if(ch > 'Z'){ ch = ch - 'Z' + 'A' - 1; } message[i] = ch; } } printf("Encrypted message: %s", message); return 0

C
Guest
code to explanationFri, 06 Jan 2023

if(dw_hourmeter_value >= HOUR_METER_MAX) /*if hour meter cross the maximum value, so roll-over hour meter value and trip meter shold rese...

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.

Guest
generate functionFri, 31 Mar 2023

arduino nanoで、奇数回ボタンを押せばサーボモータが動きながらLEDが光り、偶数回ボタンを押せばサーボモータが元の状態に戻り、LEDが消えるプログラムをC言語で書いてください。

#include <Servo.h> Servo myservo; int ledPin = 13; int servoPin = 9; int buttonPin = 2; int buttonValue = 0; int counter = 0; void setup() { myservo.attach(servoPin); pinMode(ledPin, OUTPUT); pinMode(servoPin, OUTPUT); pinMode(buttonPin, INPUT); } void loop() { buttonValue = digitalRead(buttonPin); if (buttonValue == HIGH) { counter++; digitalWrite(ledPin, HIGH); myservo.write(180); delay(1000); digitalWrite(ledPin, LOW); myservo.write(0); delay(1000); } else { if (counter % 2 == 1) { digitalWrite(ledPin, HIGH); myservo.write(180); delay(1000); digitalWrite(ledPin, LOW); myservo

C
Guest
code to explanationMon, 14 Nov 2022

function checkValidOrderId(orderid, account, platid, outputObject) { if (typeof orderid !== 'string') { throw new Error('参数错误,orderid非法'); } //格式:代理编号 +yyyyMMddHHmmssSSS+ account if (account !=...

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非法'); }

Guest
generate functionFri, 21 Apr 2023

suma de matrices con vectores

import numpy as np def add_matrix_and_vector(x, y): return x + y matrix = np.array([[1, 2], [3, 4]]) vector = np.array([6, 7]) add_matrix_and_vector(matrix, vector)

Python
Guest
generate functionSun, 05 Feb 2023

9. Разработайте приложение «7 чудес света», где каждое чудо будет представлено отдельным классом. Создайте дополнительный класс, содержащий точку входа. Распределите приложение по файлам проекта и с помощью пространства имён обеспечьте возможность взаимодействия классов.

using System; using Classes; namespace SevenWonders { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } }

C#
Guest
generate functionMon, 20 Mar 2023

Suma y resta

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; }

C++
Guest
generate functionFri, 26 Apr 2024

área y perímetro cuadrado

ript function area(x) { return x * x; } function perimetro(x) { return x * 4; } function areaPerimetro(x) { return x * x + x * 4; } function areaPerimetro2(x) { return x * x + x * x + x * 4; } function areaPerimetro3

Javascript
Guest
generate functionTue, 23 Apr 2024

Pide al usuario que ingrese el número de lados de un poligono. Utiliza un bucle while para solicitar los valores de los ángulos internos del poligono hasta que se ingresen todos. Calcula y muestra la suma de los ángulos internos.

nclude <iostream> #include <cmath> #include <cstdlib> #include <ctime> #include <algorithm> #include <iterator> #include <vector> #include <map> #include <set> #include <queue> #include <stack> #include <bitset> #include <string> #include <sstream> #include <complex> #include <limits> #include <cctype

C++
Guest

in html you can generate a beating heart with effects and colors neon

<div class="heart"> <div class="heart-main"> <div class="heart-line"> <div class="heart-line1"></div> <div class="heart-line2"></div> <div class="heart-line3"></div> <div class="heart-line4"></div> <div class="heart-line5"></div> <div class="heart-line6"></div> <div class="heart-line7"></div> <div class="heart-line8"></div> <div class="heart-line9"></div> <div class="heart-line10"></div> <div class="heart-line11"></div> <div class="heart-line12"></div> <div class="heart-line13"></div> <div class="heart-line14"></div> <div class="heart-line15"></div> <div class="heart-line16"></div> <div class="heart-line17"></div>

Guest
generate functionWed, 12 Apr 2023

Realizar un script en Python que calcule las resistencias en paralelo o en serie, pidiendo primero la cantidad de resistencias, luego el tipo de conexión en formato string si es en “serie” o en “paral...

def serie(resistencias): total = 0 for resistencia in resistencias: total += resistencia return total def paralelo(resistencias): total = 0 for resistencia in resistencias: if resistencia == 0: return 0 total += 1 / resistencia return 1 / total def total(resistencias, tipo): if tipo == "serie": return serie(resistencias) elif tipo == "paralelo": return paralelo(resistencias) else: print("Tipo de resistencia no reconocida") return None resistencias = [] while True: cantidad = int(input("Ingrese la cantidad de resistencias: ")) if cantidad > 0: break print("Ingrese una cantidad positiva") for i in range(cantidad): while True:

Python
Guest
generate functionFri, 05 May 2023

Create a Google Chrome extension that, upon activation, opens a new tab in the browser with its graphical interface. The interface should have the necessary options and filters to search for a keyword...

# -*- 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

Python
Guest
generate functionThu, 20 Apr 2023

quiero generar un boton que me permita seleccionar opciones utilizanzo react. que me permita filtrar las opciones mediante el texto que muestran y que tambien permita limpiar la seleccion con un icono de cruz en el costado derecho

import React from 'react'; import { Button, Input, Icon } from 'antd'; interface MyButtonProps { selectedOptions: any[]; onSelectedOptionsChange: (selectedOptions: any[]) => void; options: any[]; } const MyButton: React.FC<MyButtonProps> = ({ selectedOptions, onSelectedOptionsChange, options }) => { const [ text, setText ] = React.useState<string>(''); const [ dropdown, setDropdown ] = React.useState<boolean>(false); const [ filteredOptions, setFilteredOptions ] = React.useState<any[]>(options); const handleDropdown = () => { setDropdown(!dropdown); }; const handleTextChange = (e: any) => { const text = e.target.value; setText(text); const filteredOptions = options.filter(opt => opt.text.indexOf(text) > -1); setFil

TypeScript
Guest
generate functionTue, 28 Mar 2023

Menu de 3 opciones una opcion recopilar datos personales y guardarlos en una base de datos la segunda opción que recopile notas de 3 cursos y tercera opción que recopile ausencias y tardías

def menu(): print("1. datos personales") print("2. Notas de cursos") print("3. Ausencias y Tardías") print("4. Salir") opcion = int(input("Ingrese una opción >> ")) if opcion == 1: datos_personales() elif opcion == 2: notas() elif opcion == 3: ausencias() elif opcion == 4: exit() else: print("Opción incorrecta") def datos_personales(): print("Ingrese sus datos") nombre = input("Nombre >> ") apellido = input("Apellido >> ") edad = input("Edad >> ") sexo = input("Sexo >> ") print("") print("Datos Ingresados") print("Nombre: "

Python
Guest
generate functionSat, 13 May 2023

Mínimo debe haber 2 empleado por cada cargo y solo 1 empleado por cargo debe estar en turno. (no debe haber identificación repetida, cuando se cree un empleado, se debe verifica que no exista el númer...

import java.util.Scanner; public class Empleado{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String nombre, cargo; int id, horario, salario, numeroID; boolean horarioTurno = false, identificacion = true; System.out.println("Ingrese el número de empleados a registrar: "); int numeroEmpleados = sc.nextInt(); for(int i=0; i < numeroEmpleados; i++){ if(numeroEmpleados <= 10){ System.out.println("Ingrese el nombre: "); nombre = sc.nextLine(); System.out.println("Ingrese el cargo: "); cargo = sc.nextLine(); System.out.println("Ingrese el número de identificación: "); numeroID = sc.nextInt(); System.out.println("

Java
Guest
generate functionTue, 17 Jan 2023

Алгоритм шифрования и расшифровки штатной сигнализации Ford C-Max

// Список битов с сообщения // 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

C++
Guest
generate functionMon, 27 Mar 2023

1 2

def add(a, b): print(a) print(b) return a + b add(1, 2)

Python
Guest
generate functionSat, 18 Mar 2023

配列 A と追加する要素 B が与えられるので、B を A の末尾に追加したのち、A の全ての要素を出力してください。

public static void addToLast(int[] a, int b) { int count = a.length + 1; // 要素数が変わるので、別途 count 変数を用意する int[] newArray = new int[count]; for (int i = 0; i < a.length; i++) { newArray[i] = a[i]; } newArray[count - 1] = b; for (int i : newArray) { System.out.print(i); } } int[] arr = {1, 2, 3, 4, 5}; addToLast(arr, 6); System.out.println(arr);

Java
Guest
generate functionMon, 27 Mar 2023

1 2

def add(a, b): print(a) print(b) return a + b add(1, 2)

Python
Guest
generate functionWed, 26 Jul 2023

Haz un mapa de Argentina

import matplotlib.pyplot as plt import cartopy.crs as ccrs plt.axes(projection=ccrs.PlateCarree()) plt.contourf(lon, lat, temp_data[0, :, :], 60, transform = ccrs.PlateCarree()) plt.colorbar(orientation='horizontal', shrink = 0.8) plt.show()

Python
Guest
ContactPrivacy Policyzigarettenautomatkarte.de