Pierre Angelo

All generations.

generate functionWed, 05 Apr 2023

Hazme niveles de dificultad fácil, intermedio y difícil para un juego usando System.Collections; usando System.Collections.Generic; utilizando UnityEngine; public class PerlinNoise : MonoBehaviour { public GameObject cubo; Torreta GameObject pública; encendido público de GameObject; ancho int público = 30; altura interna pública = 30; int público x = 0; escala flotante pública = 100f; desplazamiento flotante público X = 100f; desplazamiento flotante públicoZ = 100f; //Usando el Random.Range gemnero de manera aleatoria los GameOjects en cada linea private void Start() { scale = Random.Range(0, 100f); offsetX = Aleatorio.Rango(0f, 99999f); offsetZ = Aleatorio.Rango(0f, 99999f); //El invocar repetición repite y ejecuta los métodos posteriores de las líneas de los GameObjects InvokeRepeating("crearCubos", 1f, 1f); } private void Update() { } //Para este método el condicional if calcula la cantidad de muros generados por la variable "clone" del gameobject "cubo" teniendo en cuenta el valor es menor que 0.4 void crearCubos() { for (int z = 0, z < altura, z++) { offsetX = Random.Range(0f, 99999f); offsetZ = Aleatorio.Rango(0f, 99999f); valor flotante = CalculateCubo(x, z); if (valor < 0.4f) { Vector3 vect = new Vector3(x, 0, z); GameObject clon = Instanciar (cubo, vect, Quaternion.identity) como GameObject; clon.SetActive(verdadero); } } } void crearTorretas() { for (int z = 0; z < altura; z++) { offsetX = Random.Range(0f, 99999f); offsetZ = Aleatorio.Rango(0f, 99999f); valor flotante = CalculateCubo(x, z); if (valor >= 0.4f) { float n = Random.Range(0f, 100f); if (n < 8f) { Vector3 vect = new Vector3(x, 0, z); GameObject clon = Instanciar(torreta, vect, Quaternion.identity) as GameObject; clon.SetActive(verdadero); } else { if (n > 96f) { Vector3 vect = new Vector3(x, 0, z); GameObject clon = Instanciar (powerup, vect, Quaternion.identity) como GameObject; clon.SetActive(verdadero); } } } } } float CalculateCubo(int x, int z) { float xCoord = (float)x / ancho * escala + offsetX; float zCoord = (float)z / altura * escala + offsetZ; muestra flotante = Mathf.PerlinNoise(xCoord, zCoord); muestra de retorno; } } GameObject clon = Instanciar (powerup, vect, Quaternion.identity) como GameObject; clon.SetActive(verdadero); } } } } } float CalculateCubo(int x, int z) { float xCoord = (float)x / ancho * escala + offsetX; float zCoord = (float)z / altura * escala + offsetZ; muestra flotante = Mathf.PerlinNoise(xCoord, zCoord); muestra de retorno; } } GameObject clon = Instanciar (powerup, vect, Quaternion.identity) como GameObject; clon.SetActive(verdadero); } } } } } float CalculateCubo(int x, int z) { float xCoord = (float)x / ancho * escala + offsetX; float zCoord = (float)z / altura * escala + offsetZ; muestra flotante = Mathf.PerlinNoise(xCoord, zCoord); muestra de retorno; } } PerlinRuido(xCoord, zCoord); muestra de retorno; } } PerlinRuido(xCoord, zCoord); muestra de retorno; } }

#include <iostream> using namespace std; void main() { int a, b, suma; cout << "Ingrese los valores de a y b"; cin >> a >> b; suma = a + b; cout << "La suma es " << suma; }

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido en unity?

LARGE_INTEGER frequency; // ticks per second LARGE_INTEGER t1, t2; // ticks double elapsedTime; // get ticks per second QueryPerformanceFrequency(&frequency); // start timer QueryPerformanceCounter(&t1); // do something // stop timer QueryPerformanceCounter(&t2); // compute and print the elapsed time in millisec elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart; printf("Elapsed time: %f ms.\n", elapsedTime);

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido?

#include <stdio.h> #include <time.h> int main () { time_t segundos; time_t segundos_actuales; struct tm *tiempo; time(&segundos); time(&segundos_actuales); tiempo = localtime(&segundos); printf ("La hora es: %s", asctime(tiempo)); segundos = time(NULL) - segundos; printf("Han pasado %d segundos desde el comienzo de los tiempos.\n", (int)segundos); return 0; }

C++
View
generate functionTue, 04 Apr 2023

f) float P06descatarMinDados(int dados, float caras): El valor del impulso será la suma de n dados. Se lanzarán n+1 dados y se descarta el menor de ellos

#import <stdio.h> #import <stdlib.h> #import <time.h> #import <math.h> int main(){ int dados = 2; float caras = 6; float impulso = 0; //generar un numero aleatorio entre 1 y caras srand(time(NULL)); for(int i = 0; i < dados; i++){ float r = rand() % (int)caras + 1; impulso += r; } printf("Numero de dados: %d\n", dados); printf("Numero de caras por dado: %d\n", (int)caras); printf("Impulso: %f\n", impulso); system("pause"); return 0; }

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido en unity?

// Example program #include <iostream> #include <string> #include <chrono> //https://stackoverflow.com/questions/22387586/measuring-execution-time-of-a-function-in-c int main() { std::chrono::time_point<std::chrono::system_clock> start, end; start = std::chrono::system_clock::now(); // do something end = std::chrono::system_clock::now(); std::chrono::duration<double> elapsed_seconds = end-start; std::time_t end_time = std::chrono::system_clock::to_time_t(end); std::cout << "finished computation at " << std::ctime(&end_time) << "elapsed time: " << elapsed_seconds.count() << "s\n"; }

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido en unity?

#include <iostream> #include <time.h> using namespace std; int main () { time_t timer; struct tm y2k = {0}; double seconds; y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0; y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1; time(&timer); /* get current time; same as: timer = time(NULL) */ seconds = difftime(timer,mktime(&y2k)); cout << seconds << " seconds since January 1, 2000 in the current timezone" << endl; return 0; }

C++
View
generate functionWed, 29 Mar 2023

A scene must be created in Unity that contains: or a cannon that automatically moves up and down on the left side from the screen. This cannon will shoot balls every second. The balls will bounce against the ground and will be destroyed when colliding with the character o The throwing force of these balls will be between 0 and 500. We will have different options to calculate this value. We will create the following functions for it: a) float P01FuerzaFija(): Impulse with fixed value (500) b) float P02RandomRange(): Random impulse in a range of values defined[200, 500] c) float P03RandomDosDados(float faces): Let the sum of two values random, such that its value is in the range [0, 500] d) float P04RandomVariousDice(int dice, float faces): Let the sum of several dice (this will be a variable that we can modify). so that the value of the sum is in the range [0, 500] e) float P05maxDice(int dice, float faces): Several dice are thrown and gets the biggest of them f) float P06discardMinDice(int dice, float faces): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the lowest one is discarded from them g) float P07discardMinAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n dice will be rolled, the minor and this one will be thrown again h) float P08discardMaxAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the greatest of them i) float P09PossibleBonus(float force, float bonus, float probability): will add a boost boost with a 20% chance of this happen o The value with which each ball is driven will be shown on the screen

#include <iostream> using namespace std; int main() { int a; cin >> a; cout << a+2 << endl; }

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido?

#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::time_point<std::chrono::system_clock> start, end; start = std::chrono::system_clock::now(); std::cout << "waiting for the end" << std::endl; end = std::chrono::system_clock::now(); std::chrono::duration<double> elapsed_seconds = end-start; std::time_t end_time = std::chrono::system_clock::to_time_t(end); std::cout << "finished computation at " << std::ctime(&end_time) << "elapsed time: " << elapsed_seconds.count() << "s\n"; }

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido en unity?

void tiempo(){ const int numFrames = 100; float deltaTime[numFrames]; int frameIndex = 0; float frameTime = 0.0f; float lastTime = 0.0f; float fps = 0.0f; for (int i = 0; i < numFrames; i++) { //Tiempo actual del frame float startTime = Time.realtimeSinceStartup; //Tiempo del ultimo frame deltaTime[frameIndex++] = startTime - lastTime; //Si el frameIndex llega al limite vuelve al comienzo if (frameIndex >= numFrames) frameIndex = 0; //Guarda el tiempo del ultimo frame lastTime = startTime; float count = 0; for (int j = 0; j < numFrames; j++) count += deltaTime[j]; //calculo del tiempo de los ultimos frames frameTime = count/num

C++
View
generate functionWed, 29 Mar 2023

A scene must be created in Unity that contains: or a cannon that automatically moves up and down on the left side from the screen. This cannon will shoot balls every second. The balls will bounce against the ground and will be destroyed when colliding with the character o The throwing force of these balls will be between 0 and 500. We will have different options to calculate this value. We will create the following functions for it: a) float P01FuerzaFija(): Impulse with fixed value (500) b) float P02RandomRange(): Random impulse in a range of values defined[200, 500] c) float P03RandomDosDados(float faces): Let the sum of two values random, such that its value is in the range [0, 500] d) float P04RandomVariousDice(int dice, float faces): Let the sum of several dice (this will be a variable that we can modify). so that the value of the sum is in the range [0, 500] e) float P05maxDice(int dice, float faces): Several dice are thrown and gets the biggest of them f) float P06discardMinDice(int dice, float faces): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the lowest one is discarded from them g) float P07discardMinAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n dice will be rolled, the minor and this one will be thrown again h) float P08discardMaxAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the greatest of them i) float P09PossibleBonus(float force, float bonus, float probability): will add a boost boost with a 20% chance of this happen o The value with which each ball is driven will be shown on the screen

float P01FuerzaFija(){ return 500; }; float P02RandomRange(){ return Random.Range(200, 500); }; float P03RandomDosDados(float faces){ return Random.Range(0, 6) + Random.Range(0, 6); }; float P04RandomVariousDice(int dice, float faces){ int sum = 0; for(int i = 0; i < dice; i++){ sum += Random.Range(0, 6); } return sum; }; float P05maxDice(int dice, float faces){ int max = 0; for(int i = 0; i < dice; i++){ int dado = Random.Range(0, 6); if(dado > max){ max = dado; } } return max; }; float P06discardMinDice(int dice, float faces){ int min = 6; int sum = 0;

C++
View
generate functionWed, 29 Mar 2023

A scene must be created in Unity that contains: or a cannon that automatically moves up and down on the left side from the screen. This cannon will shoot balls every second. The balls will bounce against the ground and will be destroyed when colliding with the character o The throwing force of these balls will be between 0 and 500. We will have different options to calculate this value. We will create the following functions for it: a) float P01FuerzaFija(): Impulse with fixed value (500) b) float P02RandomRange(): Random impulse in a range of values defined[200, 500] c) float P03RandomDosDados(float faces): Let the sum of two values random, such that its value is in the range [0, 500] d) float P04RandomVariousDice(int dice, float faces): Let the sum of several dice (this will be a variable that we can modify). so that the value of the sum is in the range [0, 500] e) float P05maxDice(int dice, float faces): Several dice are thrown and gets the biggest of them f) float P06discardMinDice(int dice, float faces): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the lowest one is discarded from them g) float P07discardMinAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n dice will be rolled, the minor and this one will be thrown again h) float P08discardMaxAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the greatest of them i) float P09PossibleBonus(float force, float bonus, float probability): will add a boost boost with a 20% chance of this happen o The value with which each ball is driven will be shown on the screen

void Start() { InvokeRepeating("BallCreator", 1.0f, 1.0f); } void BallCreator() { GameObject ball = Instantiate(Ball, transform.position, transform.rotation); Rigidbody rbBall = ball.GetComponent<Rigidbody>(); rbBall.AddForce(0, 0, P01FuerzaFija()); } float P01FuerzaFija() { return 500; }

C++
View
generate functionThu, 06 Apr 2023

Hazme un sistema de turnos en unity usando un algoritmo de budqueda lineal, binaria y ternaria que determinará el turno entre el jugador y los algoritmos en un minijuego de destapar unas cartas

int main(){ char carta[]={1,2,3,4,5,6,7,8,9,10,11,12,13}; carta[13] = NULL; int jugador = 0; int ai = 0; for(int i = 0; i < 13; i++){ //jugador int carta_jugador = rand() % 13; cout << "carta jugador: " << carta[carta_jugador] << endl; jugador += carta[carta_jugador]; //ai int carta_ai = rand() % 13; cout << "carta ai: " << carta[carta_ai] << endl; ai += carta[carta_ai]; } if(jugador > ai){ cout << "Gano jugador" << endl; } else if(ai > jugador){ cout << "Gano ai" << endl; }

C++
View
generate functionTue, 04 Apr 2023

d) float P04RandomVariosDados(int dados, float caras): Sea la suma de varios dados (éste será una variable que podamos modificar). De modo que el valor de la suma esté en el rango [0, 500]

#include <iostream> #include <ctime> using namespace std; int dado1D6(){ return rand()%6+1; } float variosDados(int dados, float caras){ float valor = 0; for(int i = 0; i < dados; i++) valor += dado1D6(); return valor/caras; } int main(){ srand(time(0)); cout << variosDados(4, 6) << endl; }

C++
View
generate functionWed, 29 Mar 2023

a) float P01FuerzaFija(): Impulse with fixed value (500) b) float P02RandomRange(): Random impulse in a range of values defined[200, 500] c) float P03RandomDosDados(float faces): Let the sum of two values random, such that its value is in the range [0, 500] d) float P04RandomVariousDice(int dice, float faces): Let the sum of several dice (this will be a variable that we can modify). so that the value of the sum is in the range [0, 500] e) float P05maxDice(int dice, float faces): Several dice are thrown and gets the biggest of them f) float P06discardMinDice(int dice, float faces): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the lowest one is discarded from them g) float P07discardMinAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n dice will be rolled, the minor and this one will be thrown again h) float P08discardMaxAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the greatest of them i) float P09PossibleBonus(float force, float bonus, float probability): will add a boost boost with a 20% chance of this happen

float P01FuerzaFija(){ return 500.0f; } float P02RandomRange(){ return static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(500-200))) + 200; } float P03RandomDosDados(float faces){ float dado1 = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(faces))); float dado2 = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(faces))); return dado1 + dado2; } float P04RandomVariousDice(int dice, float faces){ float suma=0; for (int i = 0; i < dice; ++i) { suma += P03RandomDosDados(faces); } return suma; } float P05maxDice(int dice, float faces){ float max; max =

C++
View
generate functionWed, 29 Mar 2023

A scene must be created in Unity that contains: or a cannon that automatically moves up and down on the left side from the screen. This cannon will shoot balls every second. The balls will bounce against the ground and will be destroyed when colliding with the character o The throwing force of these balls will be between 0 and 500. We will have different options to calculate this value. We will create the following functions for it: a) float P01FuerzaFija(): Impulse with fixed value (500) b) float P02RandomRange(): Random impulse in a range of values defined[200, 500] c) float P03RandomDosDados(float faces): Let the sum of two values random, such that its value is in the range [0, 500] d) float P04RandomVariousDice(int dice, float faces): Let the sum of several dice (this will be a variable that we can modify). so that the value of the sum is in the range [0, 500] e) float P05maxDice(int dice, float faces): Several dice are thrown and gets the biggest of them f) float P06discardMinDice(int dice, float faces): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the lowest one is discarded from them g) float P07discardMinAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n dice will be rolled, the minor and this one will be thrown again h) float P08discardMaxAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the greatest of them i) float P09PossibleBonus(float force, float bonus, float probability): will add a boost boost with a 20% chance of this happen o The value with which each ball is driven will be shown on the screen

float P01FuerzaFija() { return 500; } float P02RandomRange() { return Random.Range(200, 500); } float P03RandomDosDados(float faces) { return (Random.Range(1, faces) + Random.Range(1, faces)); } float P04RandomVariousDice(int dice, float faces) { float sum = 0; for(int i = 0; i < dice; i++) { sum += Random.Range(1, faces); } return sum; } float P05maxDice(int dice, float faces) { float max = 0; float temp = 0; for(int i = 0; i < dice; i++) { temp = Random.Range(1, faces); if (temp > max) max = temp; } return max; } float P06discardMinDice(int

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido?

// C++ #include <iostream> #include <chrono> #include <thread> // sleep for a while: std::this_thread::sleep_for(std::chrono::seconds(2)); // print elapsed time: auto start = std::chrono::steady_clock::now(); // do something: auto end = std::chrono::steady_clock::now(); std::cout << "Elapsed time in nanoseconds : " << std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count() << " ns" << std::endl;

C++
View
generate functionWed, 29 Mar 2023

A scene must be created in Unity that contains: or a cannon that automatically moves up and down on the left side from the screen. This cannon will shoot balls every second. The balls will bounce against the ground and will be destroyed when colliding with the character o The throwing force of these balls will be between 0 and 500. We will have different options to calculate this value. We will create the following functions for it: a) float P01FuerzaFija(): Impulse with fixed value (500) b) float P02RandomRange(): Random impulse in a range of values defined[200, 500] c) float P03RandomDosDados(float faces): Let the sum of two values random, such that its value is in the range [0, 500] d) float P04RandomVariousDice(int dice, float faces): Let the sum of several dice (this will be a variable that we can modify). so that the value of the sum is in the range [0, 500] e) float P05maxDice(int dice, float faces): Several dice are thrown and gets the biggest of them f) float P06discardMinDice(int dice, float faces): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the lowest one is discarded from them g) float P07discardMinAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n dice will be rolled, the minor and this one will be thrown again h) float P08discardMaxAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the greatest of them i) float P09PossibleBonus(float force, float bonus, float probability): will add a boost boost with a 20% chance of this happen o The value with which each ball is driven will be shown on the screen

float P01FuerzaFija() { return 500.0f; } float P02RandomRange() { //rand() we use this within a range int random = rand() % 500; random += 200; return random; } float P03RandomDosDados(float faces) { float random1 = (rand() % (int)faces) + 1; float random2 = (rand() % (int)faces) + 1; float result = random1 + random2; if (result > 500) { result = 500; } return result; } float P04RandomVariousDice(int dice, float faces) { float result = 0.0f; for (int i = 0; i < dice; i++) { result += (rand() % (int)faces) + 1; } if (result > 500) { result = 500; } return result;

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido?

#include <time.h> #include <stdio.h> #define BILLION 1000000000L; int main() { struct timespec start, stop; double accum; if( clock_gettime( CLOCK_REALTIME, &start) == -1 ) { perror( "clock gettime" ); exit( EXIT_FAILURE ); } /* Do busy work. */ accum = 0; for( int i=0; i<100000000; ++i ) accum += i*i; if( clock_gettime( CLOCK_REALTIME, &stop) == -1 ) { perror( "clock gettime" ); exit( EXIT_FAILURE ); } printf( "%lf\n", ( stop.tv_sec - start.tv_sec ) + (double)( stop.tv_nsec - start.tv_nsec )/(double)BILLION ); return 0; }

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido en unity?

#include <iostream> #include <chrono> #include <thread> int main() { using namespace std::this_thread; // sleep_for, sleep_until using namespace std::chrono; // nanoseconds, system_clock, seconds auto start = std::chrono::system_clock::now(); sleep_for(std::chrono::seconds(1)); auto end = std::chrono::system_clock::now(); std::chrono::duration<double> elapsed_seconds = end-start; std::time_t end_time = std::chrono::system_clock::to_time_t(end); std::cout << "finished computation at " << std::ctime(&end_time) << "elapsed time: " << elapsed_seconds.count() << "s\n"; }

C++
View
generate functionWed, 29 Mar 2023

A scene must be created in Unity that contains: or a cannon that automatically moves up and down on the left side from the screen. This cannon will shoot balls every second. The balls will bounce against the ground and will be destroyed when colliding with the character o The throwing force of these balls will be between 0 and 500. We will have different options to calculate this value. We will create the following functions for it: a) float P01FuerzaFija(): Impulse with fixed value (500) b) float P02RandomRange(): Random impulse in a range of values defined[200, 500] c) float P03RandomDosDados(float faces): Let the sum of two values random, such that its value is in the range [0, 500] d) float P04RandomVariousDice(int dice, float faces): Let the sum of several dice (this will be a variable that we can modify). so that the value of the sum is in the range [0, 500] e) float P05maxDice(int dice, float faces): Several dice are thrown and gets the biggest of them f) float P06discardMinDice(int dice, float faces): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the lowest one is discarded from them g) float P07discardMinAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n dice will be rolled, the minor and this one will be thrown again h) float P08discardMaxAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the greatest of them i) float P09PossibleBonus(float force, float bonus, float probability): will add a boost boost with a 20% chance of this happen o The value with which each ball is driven will be shown on the screen

#include <stdlib.h> #include <time.h> // Return random number between 0 and 500 float P02RandomRange() { return rand() % 500; } // Return random number between 0 and 500 float P03RandomDosDados(float faces) { return (rand() % faces) + (rand() % faces); } // Return random number between 0 and 500 float P04RandomVariousDice(int dice, float faces) { float result = 0; for(int i = 0; i < dice; i++) { result += rand() % faces; } return result; } // Return random number between 0 and 500 float P06discardMinDice(int dice, float faces) { int min = 0; float result = 0; for(int i = 0; i < dice + 1; i++) { int r = rand() % faces; if(i == 0) { min = r; } else if(

C++
View
generate functionWed, 05 Apr 2023

¿Cómo mostrar por pantalla el tiempo transcurrido?

#include <time.h> #include <stdio.h> #include <stdlib.h> #include <algorithm> using namespace std; int main() { int day, month, year; char date[15]; int day2, month2, year2; char date2[15]; scanf("%s", date); sscanf(date, "%2d/%2d/%4d", &day, &month, &year); scanf("%s", date2); sscanf(date2, "%2d/%2d/%4d", &day2, &month2, &year2); int time = year * 365 * 24 * 60 * 60 + month * 30 * 24 * 60 * 60 + day * 24 * 60 * 60; int time2 = year2 * 365 * 24 * 60 * 60 + month2 * 30 * 24 * 60 * 60 + day2 * 24 * 60 * 60; int diff = abs(time - time2); printf

C++
View

Questions about programming?Chat with your personal AI assistant