Вы находитесь на странице: 1из 9

TALLER PROGRAMACION

PRESENTADO POR:

LUIS ANIBAL LOAIZA CARDONA

1010073796

PRESENTADO A:

JULIO CESAR CHAPARRO PORRAS

UNIVERSIDAD TECNOLOGICA DE PEREIRA


FACULTAD DE INGENIERIAS
INGENIERIA DE SISTEMAS Y COMPUTACION
PEREIRA, RISARALDA
2018
1)Volumen residual-Scheme

; 1) objetivo: Hallar el residuo de un cubo insertado en un circulo

; plantilla. num ---> num

; encabezado. (residuo r)

; variables. r: radio

; ejemplo: (residuo 2) --> 21.193594....

; autor: Luis Loaiza

(define (residuo r)

(if(exact-integer? r)

(if( and (> r 0) (< r 50000))

(-(* (/ 4 3) (* 3.1416 (expt r 3))) (expt (/ (* 2 r) (sqrt 3))3))

(print "No es posible")

(print"solo digitos entero")

))

(residuo(read))

2)Tiempo en llenado de un cilindro-Java

package pnto2;

import java.util.Scanner;

import java.lang.Math;

import java.util.Scanner;

public class Pnto2 {


public static int filtro() {

Scanner obj;

obj = new Scanner(System.in);

int ban;

do{

try{

ban=0;

int x;

x=obj.nextInt();

return x;

catch(Exception e){System.out.println("No valido,digite un numero


entero");ban=1;obj.nextLine();}

while(ban != 0);

return 0;

public static float residuo(int m,int l,int a,int r ,int h)

{float b,ts,volumen,tiempo;
if(((a>0)&&(m>0)&&(l>0)&&(r>0)&&(h>0))&&((a<50000)&&(m<50000)&&(l<50000)&&(r<50000)
&&(h<50000)))

b=(float) (Math.sin(45)*m);

ts=(10*l*b)+(10*l*a);

volumen=(float) (Math.PI*Math.pow(r,2)*h*1000);

tiempo=volumen/ts;

return tiempo;

else

{System.out.print("Datos incorrectos");

return 0;}

public static void main(String[] args) {

int m,l,a,r,h;

System.out.println("Tiempo en llenar un cilindro,digite las medidas en metros: ");

System.out.println("Digite la altura del techo: ");

m=filtro();

System.out.println("Digite el largo del techo: ");

l=filtro();

System.out.println("Digite la medida de la canaleta: ");

a=filtro();

System.out.println("Digite el radio del cilindro: ");


r=filtro();

System.out.println("Digite la altura del cilindro: ");

h=filtro();

System.out.println("El resultado es en horas: "+residuo(m,l,a,r,h));

3)Distancia total-C++

#include<iostream>

#include<conio.h>

#include<math.h>

#include <string> // string, stoi

#include <cctype> // isdigit

#include <cstdlib> // atoi

using namespace std;

/*3.Donde a es una aceleracion en m/s2 mayor que la gravedad y donde t1 y t2 son dos tiempos
en segundos

digitados por el usuario*/

float distancia(int a,int t1,int t2)

{
float d1;

float d2;

float d3;

float dt;

float vf1;

float v2;

if (((a > 9.8) && (t1 > 0) && (t2 > 0)) && ((a < 50000) && (t1 < 50000) && (t2 < 50000))){

d1=(1/2) * a * pow (t1,2);

vf1=(a * t1);

/*.Como la aceleracion es constante , la velocidad final en la distancia 1

sera la distancia tanto de inicio como de final en la distancia 2 ,por se un m.r.u */

d2=vf1*t2;

/*.En el ultimo tramo se tienen tres datos la acelacion,la velocidad final

y la velocidad inicial que sigue siendo vf1 debido a que en el final del tramo 2 por ser un m.r.u

sigue siendo la misma velocidad */

d3=pow(vf1,2)/(2*9,8);

dt=d1+d2+d3;

return dt;

}
}

bool esNumerico(string linea)

bool b = true;

int longitud = linea.size();

if (longitud == 0) { // Cuando el usuario pulsa ENTER

b = false;

} else if (longitud == 1 && !isdigit(linea[0])) {

b = false;

} else {

int i;

if (linea[0] == '+' || linea[0] == '-')

i = 1;

else

i = 0;

while (i < longitud) {

if (!isdigit(linea[i])) {

b = false;

break;

i++;

}
}

return b;

int filtro()

string linea;

int numero;

bool repite = true;

do {

getline(cin, linea);

if (esNumerico(linea)) {

repite = false;

} else {

cout << "No ha ingresado un entero. Intente nuevamente" << endl;

} while (repite);

numero = atoi(linea.c_str());
return numero;

main ()

{ int a;

int t1;

int t2;

cout<<"Problema particulas, la aceleracion en m/s2 ,t1 y t2 en segundos" ;

cout<<"\nDigite la aceleracion :";

a=filtro();

cout<<"\nDigite el tiempo1 :";

t1=filtro();

cout<<"\nDigite el tiempo2 :";

t2=filtro();

cout<<"El resultado es: ";

cout<<distancia(a,t1,t2);

Вам также может понравиться